Trey Hunner 🐍

& educator & team trainer

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

Also a who is attempting more ethical eating (95% ) and thinks is highly underrated, but I don't post about those topics very often.

he/him

Trey Hunner 🐍treyhunner
2025-11-22

I'm announcing the Black Friday sale for Python Morsels a week early this year.

It's Lifetime Access to Python Morsels

treyhunner.com/2025/11/lifetim

Trey Hunner 🐍treyhunner
2025-11-21

You should define dunder methods on your classes in Python, but you shouldn't call dunder methods.

Read more 👉 trey.io/p0h32w

Trey Hunner 🐍treyhunner
2025-11-21

Python's f-strings immediately interpolate the expressions within their replacement fields (the bit between the curly braces).

Read more 👉 trey.io/n4mlgb

Trey Hunner 🐍treyhunner
2025-11-20

@pganssle thanks!

Trey Hunner 🐍 boosted:
Amanda Hogan :breadified:hogesonline@aus.social
2025-11-20

Yesterday I was talking to a bunch of computer science teachers about how proud I was that my best programmer in y12 was a girl and one of the middle aged men said quite sagely that he tells his boys that they should look forward to working with girls because they're a different style of programmer and they may not be as good or as fast but they are excellent *communicators*.
He saw no irony in saying that to me when I could program him into a corner with my hands tied behind my back. Snort
#csed

Trey Hunner 🐍treyhunner
2025-11-19

I released a new version of uvrs that includes commands to run pip and to launch a Python REPL for a given script.

github.com/treyhunner/uvrs?tab

Trey Hunner 🐍treyhunner
2025-11-19

What online 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)

Trey Hunner 🐍treyhunner
2025-11-19

@pganssle I figure you might have thoughts on this.

I'm trying to avoid making my own giant dictionary mapping just for my most common timezone mappings. 😅

Trey Hunner 🐍treyhunner
2025-11-19

@emattiza Thanks! That gives me the first one but not the others. It seems like there may not be one service that includes a translation between all common formats.

Trey Hunner 🐍treyhunner
2025-11-19

@shearichard I mean I enter PST and it spits out the likely equivalents. I don't care too much whether it gives me just the most likely match or gives me all the possible options (CST could mean Central Standard Time or China Standard Time for example).

Trey Hunner 🐍treyhunner
2025-11-19

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.

I will also accept Python packages that convert between all these things.

Trey Hunner 🐍 boosted:
Tim SchillingCodenameTim
2025-11-19

The Debug Toolbar is looking for some help.

If you're interested in seeing helping out, we have more information available at github.com/orgs/django-commons including how to submit your application.

Trey Hunner 🐍treyhunner
2025-11-19

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 👉 trey.io/l4b84k

Trey Hunner 🐍treyhunner
2025-11-18

@pg The couple times I've tried a similar conversion with an LLM it worked great.

I never properly learned the shell syntaxes for sh, bash, or zsh and I don't plan to properly learn them anytime soon.

I'm curious to hear whether this works well.

Trey Hunner 🐍treyhunner
2025-11-13

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 👉 trey.io/l4b84k

Trey Hunner 🐍treyhunner
2025-11-12

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 programmers often use parentheses in Python.

pym.dev/unnecessary-parenthese

Trey Hunner 🐍treyhunner
2025-11-11

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.

Trey Hunner 🐍 boosted:
2025-11-10

Are you an experienced speaker and want to help someone with their #PyConUS 2026 proposal? Join the PyCon US Proposal Mentorship Program! We typically get 2x the number of mentees seeking support than we do for volunteer mentors, and need your help!

📝 Sign up to mentor here: bit.ly/4ic3i01 by Nov 21, 2025

Trey Hunner 🐍treyhunner
2025-11-10

If you're starting a new project and you need to generate UUIDs, I'd recommend taking a look at uuid7

Read more 👉 trey.io/flfwr9

Trey Hunner 🐍treyhunner
2025-11-10

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 REPL supports block-based navigation via the previous-history and next-history commands.

github.com/treyhunner/pyrepl-h

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst