Trey Hunner
banner
trey.io
Trey Hunner
@trey.io
Python & Django team trainer

I help folks sharpen their Python skills with https://PythonMorsels.com 🐍🍪

YIMBY. 95% vegan.
This is the week of the year (in the US) where "pie hole" is a somewhat suitable term for the mouth.

Also our house smells delicious right now. 🥧
November 26, 2025 at 4:18 AM
Stack Overflow is great for fixing today's bug, but what about the Python knowledge gaps you don't know you have?

Python Morsels gives you structured weekly practice to level up systematically, not reactively.

Lifetime access is available now through Dec 1st
Black Friday Deal: Python Morsels Lifetime Access
Pay once, get access for life.
pym.dev
November 25, 2025 at 11:45 PM
Reposted by Trey Hunner
I am working on a list of Black Friday/Cyber Monday deals for the Diversify Tech newsletter!

If you have anything for Software Engineers, Designers and Data professionals, please let me know!
November 25, 2025 at 4:22 PM
We don't really need those names, but the purpose of those numbers is easier to guess about and much easier to look up when we use variable names. Read more �‘‰ https://trey.io/nb3z3t #Python
November 25, 2025 at 3:13 AM
Reposted by Trey Hunner
Today’s xkcd made me cry.

In a good way.

xkcd.com/3172/
November 24, 2025 at 11:46 PM
Are you a #Python user and a lifelong learner?

I've just published my 8th annual list of every Python-related Black Friday / Cyber Monday sale I'm aware of.
Python Black Friday & Cyber Monday sales (2025)
It’s time for some discounted Python-related skill-building. This is my eighth annual compilation of Python learning-related Black Friday & …
treyhunner.com
November 24, 2025 at 4:41 PM
Think of Python Morsels as a gym membership for your Python skills. Small amounts of consistent work build up to noticeable progress.

It's usually an annual subscription, but you can get lifetime access through Dec 1st.
Black Friday Deal: Python Morsels Lifetime Access
Pay once, get access for life.
pym.dev
November 24, 2025 at 4:02 AM
Reposted by Trey Hunner
I needed to see which packages were pulling in six.

Two ways:

- uv tree --package six --invert → quick “who depends on this?” from uv.lock

- uv pip tree --package six --invert --show-version-specifiers → more pipdeptree-style, constraint-aware view from the actual env
November 23, 2025 at 1:00 PM
I'm announcing the Black Friday sale for Python Morsels a week early this year.

Lifetime Access to Python Morsels
Python Morsels Lifetime Access Sale
If you code in Python regularly, you’re already learning new things everyday. You hit a wall, or something breaks. Then you search around, …
treyhunner.com
November 22, 2025 at 3:37 AM
You should define dunder methods on your classes in Python, but you shouldn't call dunder methods. Read more �‘‰ https://trey.io/p0h32w #Python
November 22, 2025 at 1:26 AM
Python's f-strings immediately interpolate the expressions within their replacement fields (the bit between the curly braces). Read more �‘‰ https://trey.io/n4mlgb #Python
November 21, 2025 at 1:26 AM
Reposted by Trey Hunner
Anyone see a good definition for AI hallucinations that explains it well for people who are non-technical? If you do, please forward it to me! Thank you! 🙏
November 20, 2025 at 3:06 PM
I released a new version of uvrs that includes commands to run pip and to launch a Python REPL for a given script.
GitHub - treyhunner/uvrs: Create and run uv scripts with POSIX standardized shebang line
Create and run uv scripts with POSIX standardized shebang line - treyhunner/uvrs
github.com
November 19, 2025 at 10:42 PM
What online #Python communities would you most recommend?

For someone new to Python?

For someone using Python but not yet tapped into a community? (outside of their work place / friends)
November 19, 2025 at 8:33 PM
Anyone know a site where I can enter a location and it'll tell me all these:

• IANA Time Zone Identifier (America/Los_Angeles)
• Legacy Country/Region Alias (US/Pacific)
• Specific Timezone Abbreviation (PST or PDT)
• Generic Timezone Abbreviation (PT)

Bonus points if it can convert between them.
November 19, 2025 at 5:52 PM
The strftime method does the opposite of strptime: it converts datetime objects to strings, allowing us to specify the format we'd like to use during that conversion. Read more �‘‰ https://trey.io/l4b84k #Python
November 19, 2025 at 1:26 AM
Reposted by Trey Hunner
In the last decades, the world has made fantastic progress against extreme poverty. In 1990, 2.3 billion people lived in extreme poverty. Since then, the number of extremely poor people has declined by 1.5 *billion* people. 🧵
November 17, 2025 at 11:24 AM
The strftime method does the opposite of strptime: it converts datetime objects to strings, allowing us to specify the format we'd like to use during that conversion. Read more �‘‰ https://trey.io/l4b84k #Python
November 13, 2025 at 9:29 AM
Python allows parentheses just about anywhere, but some unnecessary parentheses can increase confusion more than they increase readability.

I just published a new article on the interesting ways that new #Python programmers often use parentheses in Python.
Unnecessary parentheses in Python
Python's ability to use parentheses for grouping can often confuse new Python users into over-using parentheses in ways that they shouldn't be used.
pym.dev
November 12, 2025 at 2:45 AM
It's interesting that Python 2 ingrained "print statement" into our collective vocabular so deeply that the phrase is still widely used even though print hasn't been a statement since Python 2.
November 10, 2025 at 11:45 PM
If you're starting a new project and you need to generate UUIDs, I'd recommend taking a look at uuid7 Read more �‘‰ https://trey.io/flfwr9 #Python
trey.io
November 10, 2025 at 7:19 PM
I added support for paragraph-based navigation (moving between groups of consecutive non-blank lines) to pyrepl-hacks and also documented the fact that the #Python REPL supports block-based navigation via the previous-history and next-history commands.

github.com/treyhunner/p...
GitHub - treyhunner/pyrepl-hacks: Hacky extensions and helper functions for the new Python REPL.
Hacky extensions and helper functions for the new Python REPL. - treyhunner/pyrepl-hacks
github.com
November 10, 2025 at 7:04 PM
Reposted by Trey Hunner
My PyBay talk recording is up!
“Just because AI can write your tests… should it?”

youtu.be/Lha1741iEjE

It starts with a tangent about honeybees vs native bees, but I swear, I found a way to relate that topic to the talk.

Enjoy! 🐝
Just because AI can write your tests - should it? — Pamela Fox (PyBay 2025)
YouTube video by SF Python
youtu.be
November 9, 2025 at 3:20 PM
As Chris & Chris note, I *do* LOVE the Python REPL.

If you're in the Python REPL often, play with pyrepl-hacks and let me know what you think.

I'd also love to hear if you have ideas for more commands (or features) to add.

Post: treyhunner.com/2025/10/hand...

Project: github.com/treyhunner/p...
November 7, 2025 at 10:11 PM
I usually prefer to reach for f-strings when formatting datetime objects because it's a bit shorter than the alternative. Read more �‘‰ https://trey.io/l4b84k #Python
November 7, 2025 at 7:19 PM