Trey Hunner
@trey.io
2.8K followers 180 following 530 posts
Python & Django team trainer I help folks sharpen their Python skills with https://PythonMorsels.com 🐍🍪 YIMBY. 95% vegan.
Posts Media Videos Starter Packs
trey.io
Due to the laziness of reversed(), if we were to pass it lots of items (say 100,000 items) we won't end up copying the iterable that we gave it. Read more �‘‰ https://trey.io/ur7l4g #Python
trey.io
trey.io
Not just on newer versions, but all supported versions since Python 2.7 and 3.5 were end-of-life'd in 2020.

If f-strings are valid Python syntax, dictionaries are ordered.
trey.io
I guess it's October because this office hour was scary... 👻

We discussed:

• Infinitely recursive data structures 🧟
• __new__ vs. metaclass's __call__ vs. class decorators vs. function with __mro_entries__ 👹
• ways to create a context manager 🔮
• pth files 🧌
• modifying sys.path in PYTHONSTARTUP 🦹🏻
trey.io
My #Python office hours start in less than 1 hour.

It's casual and you can participate as much or as little as you like.

Come as you are and hopefully you'll learn something by the end.
Python Morsels Office Hours
Join Trey for 13 weekly office hour sessions. Free for everyone!
pym.dev
trey.io
If you had the ability to run some Python code in every Python REPL launched on your machine what would it do? (Automagically available PyPI dependencies are allowed)

Asking for someone who just realized they are not yet heavily overusing their PYTHONSTARTUP file. (me)

All ideas welcome.

#Python
trey.io
You're welcome! Thanks for another great talk.
trey.io
You can now install 3.14.0 from uv or pyenv. If you have either on your machine, install #Python 3.14 and try it out!

Here are my favorite features, summarized in a 6 minute video/article.
Python 3.14's best new features
Python 3.14 includes syntax highlighting, improved error messages, enhanced support for cocurrency and parallelism, t-strings and more!
pym.dev
trey.io
When we use comprehensions our code looks like the data structure that we're trying to create. Read more �‘‰ https://trey.io/aeo9fg #Python
trey.io
Python 3.14 is now out! 🐍🥧🎉

My favorite new features include:

• All the color (REPL & PDB syntax highlighting, argparse help, unittest, etc.)
• pathlib's copy & move methods
• date.strptime
• uuid7
• argparse choice typo suggestions
• t-strings
• concurrent subinterpreters
• import tab completion
Python 3 14's best new features
YouTube video by Python Morsels
youtu.be
trey.io
Ah since you don't support HTTPS at all, I assume extensions that redirect to SSL versions of sites won't pose a problem. Smart. Thanks!
trey.io
Same number of characters as example.com, but more fun to type!
Example Domain
example.com
trey.io
List comprehensions create a new list, and since we've embedded a comprehension within a comprehension, this code creates a list-of-lists Read more �‘‰ https://trey.io/aeo9fg #Python
trey.io
Very curious to hear whether there's an answer to this one!

I have my own homegrown set of tools for patching stdin in various ways, patching sys.argv, importing a module is if __name__ was __main__, etc.

A single package that can do all that for me would be great.
Reposted by Trey Hunner
pamelafox.bsky.social
Is there an equivalent of playwright/selenium for CLI tool E2E testing?
Reposted by Trey Hunner
rachellcalhoun.bsky.social
10 years ago I organized my, & the, 1st #DjangoGirls event in Seoul, South Korea: 70/425 applicants accepted, it was a huge success. And was the start of a wonderful decade that launched my #Django community involvement and career. 💻

I feel grateful, proud, and inspired to keep paying it forward.🧡
Screenshot "Rachell Calhoun, October 2, 2015. We kicked off today with installations, wine, photos, and laughs. Thanks to everyone that came out and see you tomorrow! (I'm the 'L'!!!!)." Below this message there are five people waving sparklers spelling out "Seoul" in the dark night outside on a roof.
Reposted by Trey Hunner
pytexas.org
Join us next Tuesday for our monthly 📆 meetup! This month we'll be joined by @webology.bsky.social as he shows us how he uses Claude Code 🧑‍💻 to increase his productivity in both his professional and open source projects! 🤩

We hope to see y'all there! Info in the comments

#PyTexas
#python
#Meetup
trey.io
The problem is that we're taking whatever list was passed into our class and we're storing it directly on our class instance. Read more �‘‰ https://trey.io/rbi1o4 #Python
trey.io
Who needs caffeine to wake up when you have adrenaline? 😳
trey.io
Teaching a workshop right now and my computer turned off mid-sentence.

It felt like it may have been overheating so I stuck it in the freezer for a minute and started it up again. 🥶

Never had that happen before.

It's seems to be working... so far? 😅
trey.io
This is an unfortunately annoying ongoing Bluesky-specific issue with the system I use for posting. I may end up reinventing my own wheel to fix it in a few months. 😬
trey.io
The strptime method is being added to the datetime module's date and time classes in Python 3.14 (I've wanted these for YEARS).

It takes someone to champion good ideas.