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 & #Django educator & team trainer
I help folks sharpen their Python skills with https://PythonMorsels.comππͺ
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 Newsletter | https://pym.dev/newsletter |
| π Python Exercises | https://www.pythonmorsels.com |
| πΊ YouTube | https://www.youtube.com/@PythonMorsels |
| πΈ Personal Blog | https://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 π€
Another very common way to avoid issues with default argument values is to avoid using mutable default values.
Read more π https://trey.io/rbi1o4
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).
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.
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
I've only offered Python Morsels lifetime access ONCE before in 8 years.
If you're considering subscribing, consider lifetime access.
Sale ends tomorrow.
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