Articles tagged with python
Here are some of the new features in Python 3.11:
- Fine-grained error locations in tracebacks. Python 3.11 now provides more
information about the location of errors in tracebacks. This can help you to
quickly identify the source of an error and fix it.
- Exception Groups and except*. Python …
What is type checking?
Type checking is a process of verifying that the types of variables, expressions,
and statements in a program are consistent with the expected types. Type checking
can be performed statically, at compile time, or dynamically, at runtime.
Benefits of type checking in Python
There are many …
from unittest import IsolatedAsyncioTestCase
from unittest.mock import create_autospec, patch
from foo import is_foo, is_bar, platform
platform.uname_result, system="Linux …
I thought it would be neat to keep an eye on the popular google search terms
related to Python.
Google Trends. You
can use the kebab menu icon to choose between "Top" and "Rising" search phrases.
I was recently asked to take two lists and interleave them. Although I can not
think of a scenario off the top of my head where this might be useful, it doesn't
strike me as a completely silly thing to do.
StackOverflow's top answer
for this problem uses
Things have changed quite a lot since this post was originally written in 2016.
Currently, I would recommend switching over to making asynchronous calls via
One of my scripts that makes an API call has been failing silently lately. It
appears that the connection is timing out, but I …
The new year is finally upon us. Traditionally, I have not been one to make New
Year's Resolutions. This year, I decided that rather than a list of resolutions,
I would create a list of goals. These are things I would like to achieve over the
next year. In other …
I've got some code that generates loss reports for EVE Online. It uses the
EVE-KILL API and
Python's urllib2 library. Near
the end of October 2015, I noticed that my calls to the API were returning a
403: Forbidden error from the server. I didn't realize it at the time …
Although I was getting this output in relation to one of my Jinja2 templates, it
really isn't a Jinja2 problem.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 69: ordinal not in range(128)
The bit of code here should be doing nothing more than printing a float …
I've mentioned before that
empty strings in Python are false.
This leads to a common
if not string paradigm. Unfortunately, this can be
problematic. Check out this snippet:
>>> string = ""
>>> if not string:
That pretty much worked out just as we imagined. The empty string returned