Trey Hunner π
@treyhunner@mastodon.social
#Python & #Django educator & team trainer
I help folks sharpen their Python skills with https://pythonmorsels.comππͺ
Also: ostrovegan, sentientist, YIMBY, and I think economics is highly underrated. I don't post about any of 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
Recent public posts
- Python Tip #241 (of 365): Let dataclasses write your dunder methods. The dataclass decorator writes __init__, __repr__, and __eq__ for you: from dataclasses imp...
- Whereabouts Daily πΊοΈ August 29, 2026 5/5 countries in 5/13 guesses π’π’π’π’π’ https://whereabouts.earth/daily/ #Whereabouts
- Python Tip #240 (of 365): Dunder methods are meant to be defined, but not called. Do this: str(today) Not this: today.__str__() Why avoid calling dunder methods...
- βSo if you need a stack-like structure in Python, use a list.β Read more π https://pym.dev/stacks-and-queues/ #Python
- Does your team want to improve the way you write your Python code? Book a call! I may or may not be able to help, but I'm always open to chat. https://truthful....
- Python Tip #239 (of 365): When implementing __eq__, return NotImplemented for objects you don't know how to work with. Filling in __eq__ on yesterday's Version ...
- My screencast on Python's special NotImplemented value is now public. Screencast: https://youtu.be/wI4K7faxZ_Q. Article: https://pym.dev/when-to-use-notimplemen...
- I wrote something today about Dolly Parton and #DjangoConUS. https://treyhunner.com/2026/08/a-dolly-parton-developer/
- Python Tip #234 (of 365): Don't inherit from list or dict. You could end up with some weird bugs. Say we make a bi-directional dictionary by customizing __setit...
- @AlSweigart Maybe Apple added share support? I haven't touched the code for the share feature in a while.
- I knew that border wasn't where my brain likes to assume it is but I still thought I was on the right side of the border. Whereabouts Daily πΊοΈ August 22, 2026 ...
- Python Tip #233 (of 365): Don't return self from a method just to allow method chaining. In Python, methods that mutate an object usually return None. Functions...
- LWN covered my talk on pathlib from #PyConUS! If you're using #Python and not using the pathlib module, check it out. I think that it's one of the most underuse...
- Python Tip #229 (of 365): Don't overuse classes. Writing Python code does NOT require writing classes. Unlike many programming languages, you can accomplish qui...
- Whereabouts Daily πΊοΈ August 17, 2026 5/5 countries in 9/13 guesses π’π‘π‘π π’ https://whereabouts.earth/daily/ #Whereabouts
- Alex Martelli coined the term "goose typing" to describe this ability in Python to practice duck typing while also using isinstance and issubclass. Read more π...
- sincewhen now includes features that are removed from Python and their removal version. https://pym.dev/since or "uvx sincewhen" If you catch features it doesn'...
- New article on goose typing in Python (yes, that's actually a thing). You can duck typing WHILE type checking. https://pym.dev/goose-typing. #Python
- Python Tip #214 (of 365): Use truthiness for integers with caution. I DO rely on truthiness checks for integers, but not always. I would recommend only using th...
- Did you know that map()/filter() were added to Python 6 years before comprehensions? Also range() was added 9 years before zip() which was added 3 years before ...