Trey Hunner
@trey
Python & Django team trainer I help folks sharpen their Python skills with 🐍🍪 I also blog at & run YIMBY. 95% vegan.
Apparently Claude users get 3 free credits to try "/code-review ultra". I spend 2 of my 3 free credits on the same PR and got the same results both times. I feel like each of these results were a review of Anthropic's code than of my own. 🤔
Python Tip #212 (of 365): Use any() and all() to check a condition across every item in an iterable 🧵 This: any_negative = False for n in numbers: if n < 0: any_negative = True break Can be rewritten as this: any_negative = any(n < 0 for n in numbers) #Python #DailyPythonTip
New daily game I've been enjoying hankgreen.com/smush · Jul 11 852 pts · PERFECT 💯 · 2-day streak 🥞🥞🥞 🥞⭐🥞 🥞🥞🥞
My closest match doesn't surprise me. I would have been very surprised if I was categorized as a "doomer".
I made it so that once I'm expected to remember the location of a country for over 3 weeks, Whereabouts.Earth will make a confetti explosion where the bits of confetti are made of the flags of the countries I now remember so well! 🎊🇦🇶 I've been having fun making features that bring me joy. 💖
But I would recommend using functools.cached_property instead. With @cached_property the value is computed once, then cached as a regular attribute. The first access does the work. Every access after that is instant. pym.dev/p/2mjp9/
A @property recomputes its value every time it's accessed. That's fine for computing values that should stay synced each time the attribute is accessed. But if the computation is expensive, you might not want to redo it every time. pym.dev/p/24n3p/
Announcing whereabouts.earth for the second time today, this time with a video for those who'd prefer to watch me use it than try it out. I've really been enjoying sharing this with folks today. Happy #EarthDay all! 🌍
A Magritte moment from @davepeck.org during the last talk of #PyCascades on t-strings
Python Tip #54 (of 365): Copy-paste your way into comprehensions. 🧵 Have a "for" loop that loops over one list to build up another? You can probably copy-paste your way from a loop into a comprehension. #Python #DailyPythonTip
When your UI makes a user think "eh there's a 75% chance that this is the right button", something has gone wrong.
Apparently I'm pretty consistent with what I talk about on Bluesky. 😅 ... also I use that 😅 emoji a lot My most-used words in 2025 were: 1. "python" (360×) 2. "code" (43×) 3. "function" (39×) 4. "pyconus" (36×) 5. "morsels" (35×) See which words you used the most here: anisota.net/harvest
Increased diversity in communities usually comes from active outreach work. PyCon's has a partially blinded talk selection processes. If 300 people submit talks and 294 are men, then 98% of talks will likely be from men. If 500 people submit talks and 394 are men, then ~79% will likely be by men.
When you type code into the Python REPL, it will be colorized as you type it. Read more 👉 https://trey.io/flfwr9 #Python
So when writing a file using Python's csv module, you're expected to always specify newline="" when opening the file you're writing to, to make sure that you don't accidentally double up your carriage returns on Windows. Read more 👉 https://trey.io/ca0qyn #Python
This is such a weird email to get from the Social Security Administration... 🙁
But PEP8 (the official Python style guide) recommends putting binary operators (operators that go in between two values, like and and or) at the beginning of each line, for the sake of readability. Read more 👉 https://trey.io/f98u5c #Python
Working with file paths in Python? (splitting, joining, navigating, etc.) Check out #Python's pathlib module. It's great for splitting/joining paths, finding files by filename patterns, renaming files, and more. pym.dev/pathlib-module
Enjoyed this morning's #PyConUS keynote from @tfmfm.bsky.social & @geoffhing.bsky.social on a very important use for #Python. is.gd/tmppyconus
Hello #PyConUS attendee who I have probably never met! If you would like to say hello, please message me while we're both in the same city together! I'm on Signal at trey.02. More contact details at trey.io/pycon Also I have Python Morsels stickers! I'd love to give you one. 🐍🍪
When chatting in the hallway at PyCon, try leaving a gap for someone else to join the conversation. #PyConUS
We're playing Cabo and other games in the Westin lobby. Come join us #PyConUS folks!
Hey #NBPy folks! 👋 I'm flying out tonight, so if you would like a Python Morsels sticker, hug, or a chat, find me today. I would love to say hey to you if we haven't met yet! If you would like a Python Morsels sticker today PLEASE ask me for one (or 10!). I brought so many! 🐍🍪😅