Trey Hunner 🐍

@treyhunner
2.4K Followers
302 Following
3.9K Posts

#Python & #Django educator & team trainer

I help folks sharpen their Python skills with https://PythonMorsels.com🐍πŸͺ

#pythonoddity

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

he/him

πŸ’Œ My Weekly Newsletterhttps://pym.dev/newsletter
🐍 Python Exerciseshttps://www.pythonmorsels.com
πŸ“Ί YouTubehttps://www.youtube.com/@PythonMorsels
πŸ•Έ Personal Bloghttps://treyhunner.com

Support for PEP 723 (inline script metadata) has landed on pip's main branch thanks to some helpful guidance from the maintainers.

https://github.com/pypa/pip/commit/36987b0c31b97ffb9fb7949ded628e9a6b10c016

Here's hoping it'll smooth out some distribution wrinkles for people who have been getting along with just-pip and single-file scripts paired with requirements files 🀞

#Python

Support installing requirements from inline script metadata, Γ  la PEP… Β· pypa/pip@36987b0

… 723 (#13052) Adds --requirements-from-script to install requirements declared within inline script metadata (PEP 723). The slightly unwieldy name reflects that pip will also check the requires-p...

GitHub

Another very common way to avoid issues with default argument values is to avoid using mutable default values.

Read more πŸ‘‰ https://trey.io/rbi1o4

#Python

Mutable default arguments

In Python, default argument values are defined only one time (when a function is defined).

FINAL HOURS: Python Morsels Lifetime Access sale ends tonight! ⏰

One payment for Python learning forever.

I won't offer this again anytime soon (maybe ever).

https://pym.dev/lifetime-access-sale

Black Friday Deal: Python Morsels Lifetime Access

Pay once, get access for life.

For part 2, I spent a few minutes trying to figure out how to correctly use if statements and floor division to figure out the number of times zero would have bit hit.

I then did what I'd do in the real world: realize thinking through the efficient mathematical approach wasn't worth it because I'm spending minutes to save milliseconds and just use a loop within a loop.

#Python #AdventOfCode

This is the first year I decided to actually attempt Advent of Code.

Fortunately, it's also the first year there will only be 12 of them (committing to 25 days always felt like too much).

I just completed "Secret Entrance" - Day 1 - Advent of Code 2025 #AdventOfCode

https://adventofcode.com/2025/day/1

Day 1 - Advent of Code 2025

Ah yes, the famous three operating systems.
Posix, NT and Java

#Python #Java #Posix #Linux #Windows #Macos

Can you help me test a change to how coverageβ€€py is packaged? It will take five minutes:
https://gist.github.com/nedbat/9b63b040cddd4778447cce21062d0843
repro.md

GitHub Gist: instantly share code, notes, and snippets.

Gist

I've only offered Python Morsels lifetime access ONCE before in 8 years.

If you're considering subscribing, consider lifetime access.

Sale ends tomorrow.

https://pym.dev/lifetime-access-sale

Black Friday Deal: Python Morsels Lifetime Access

Pay once, get access for life.

If you'd like to try 3 months of Kagi for free, DM me. They're doing a holiday promo where users can share a longer free trial with friends. I've been happily using Kagi as my search engine for a while now.

What's inside a Python Morsels subscription?

πŸ“Ή 235+ video lessons
✍️ 262+ hands-on exercises
🎯 500+ optional challenges
πŸ“š 303+ reference articles
πŸ†• New content added weekly

Get it ALL with lifetime access (ending Monday) β†’ https://pym.dev/lifetime-access-sale

Black Friday Deal: Python Morsels Lifetime Access

Pay once, get access for life.