Python & Django team trainer
I help folks sharpen their Python skills with https://PythonMorsels.com ππͺ
I also blog at https://treyhunner.com & run https://Whereabouts.Earth
PSF Fellow. YIMBY. 95% vegan.

@trey.io
Python & Django team trainer
I help folks sharpen their Python skills with https://PythonMorsels.com ππͺ
I also blog at https://treyhunner.com & run https://Whereabouts.Earth
PSF Fellow. YIMBY. 95% vegan.
πΊοΈ October 13, 2026
5/5 countries in 5/13 guesses
π’π’π’π’π’
whereabouts.earth/daily/
#Whereabouts
πΊοΈ October 12, 2026
5/5 countries in 9/13 guesses
π’π‘π‘π π’
whereabouts.earth/daily/
#Whereabouts
How well do you know Python 3.15's new features? I made a quiz of some of my favorite features so you can test yourself.
Note that help works offline. Even if you're stuck without Internet access, you can still read documentation. From your terminal, "python3 -m pydoc math" will show the same documentation you'd see with help(math) in a REPL.
Once you're INSIDE the help pager (on Linux and Mac), you can use these keyboard shortcuts: β’ Arrow keys (or j/k) to scroll β’ / to search within the page β’ q to quit On Windows, Enter scrolls a line, Space scrolls half a screen, and q quits.
Pass a string to help to look up an operator or a keyword: >>> help("**") The power operator ****************** ... Not sure what you can look up? Ask help for "topics", "symbols", or "keywords".
You can pass help a function, a module, a class, or even an instance of a class: >>> numbers = [2, 1, 3, 4] >>> help(numbers) Help on list object: class list(object) | list(iterable=(), /) ... Passing a class (or instance) shows the class docstring plus documentation for every method.
Python Tip #285 (of 365):
Learn to use the help function. π§΅
>>> help(print)
Help on built-in function print in module builtins:
print(*args, sep=' ', end='\n', file=None, flush=False)
Prints the values to a stream, or to sys.stdout by default.
...
βDictionaries are meant to make it easy to look up the value that corresponds to a particular key.β
Read more π pym.dev/using-dictio...
Why not use this in an installable package? sys.path is shared by the whole program. A library that inserts its own directories could shadow modules in the code that imports it. I'd rather see a package explicitly list dependencies than vendor those dependencies in a way that could break MY code.
Unlike sys.path.append(...), sys.path.insert(0, ...) goes to the front. Python checks these directories in order, so YOUR module is found first, even if another directory has a module with the same name.
The sys.path list contains the directories Python searches when looking for modules and packages to import. It's a plain list of strings, so you can add to it at runtime. Once your module's directory is in there, you can import your module as usual: import silly_module
Python Tip #284 (of 365):
Import from another directory by adding it to sys.path. π§΅
sys.path.insert(0, str(Path(__file__).parent / "vendored_utils"))
This is a bit of a hack. It works great in your own project, but I wouldn't want to see it in an installable package.
πΊοΈ October 11, 2026
5/5 countries in 5/13 guesses
π’π’π’π’π’
whereabouts.earth/daily/
#Whereabouts
βWhether something happens to be implemented as a class or a function is often just an implementation detail.β
Read more π pym.dev/class-or-fun...
πΊοΈ October 10, 2026
5/5 countries in 5/13 guesses
π’π’π’π’π’
whereabouts.earth/daily/
#Whereabouts
If you're curious about the new lazy imports in Python 3.15, see my screencast & article on my favorite 3.15 features.
For either import style, I'd only do this for imports that are slow AND optional. And you probably don't want lazy imports in a web app. They'd make startup faster but the first request using each module slower. Slower startup and faster requests is usually the better tradeoff.
Python 3.15 also adds EXPLICIT lazy imports, with the lazy keyword: lazy import matplotlib.pyplot as plt The import can stay at the top of the file, but the module isn't loaded until the first time plt is used. Until you upgrade to Python 3.15, a function-level import is pretty reasonable.
One fix is to move the import into the function that needs it: def plot_results(results): import matplotlib.pyplot as plt ... Now matplotlib is only imported when plot_results is called. Tip #256 used this trick to work around a circular import. Here it's to reduce startup time instead.