@
πΊοΈ November 5, 2026 5/5 countries in 6/13 guesses π’π’π‘π’π’ whereabouts.earth/daily/ #Whereabouts https://whereabouts.earth/daily/
@
Python Tip #308 (of 365): Match tuple-like data by shape with match-case. π§΅ >>> point = (3, 4) >>> match point: ... case (x, y): ... print(f"2D point ({x}, {y})") ... case (x, y, z): ... print(f"3D point ({x}, {y}, {z})") ... 2D point (3, 4) #Python #DailyPythonTip
@
βThere's also now an official way to invent your own sentinel values in Python.β Read more π pym.dev/python315/ #Python https://pym.dev/python315/
@
πΊοΈ November 4, 2026 5/5 countries in 7/13 guesses π’π‘π’π‘π’ whereabouts.earth/daily/ #Whereabouts https://whereabouts.earth/daily/
@
I wrote another article for LWN this month. It's subscriber-only right now but you can use this link to read it without a subscription: https://lwn.net/SubscriberLink/1104646/ab9835bf6db98879/
@
Should you delete #Python syntax that isn't strictly necessary? Not always! I just published a new article on different kinds of "unnecessary" syntax in Python and why I often prefer to use these. The TL;DR: explicit is better than implicit https://pym.dev/unnecessary-syntax/
@
Your House Rep just started a new term. Have you asked them to co-sponsor the End Kidney Deaths Act yet? I wrote up my thoughts on it last year: https://treyhunner.com/2025/05/lets-end-kidney-deaths/ I'm on the mailing list of the primary organizer and it needs more Reps to read, understand, and sponsor it.
@
πΊοΈ November 3, 2026 5/5 countries in 6/13 guesses π’π’π‘π’π’ whereabouts.earth/daily/ #Whereabouts https://whereabouts.earth/daily/
@
16 digits of pi not enough? >>> import math >>> math.pi 3.141592653589793 You can ask Python for more digits and... it'll give you incorrect ones! >>> print(f"{math.pi:.42f}") 3.141592653589793115997963468544185161590576 Correct digits: 3.1415926535897932384626433832795028841971 #PythonOddity
@
Python Tip #309 (of 365): Make dataclasses instead of named tuples. π§΅ Do this: @dataclass class Room: name: str number: int Not this: class Room(NamedTuple): name: str number: int #Python #DailyPythonTip
@
Python Tip #306 (of 365): Don't use tuples for list-like data. π§΅ Do this: colors = ["pink", "purple", "green", "blue"] Not this: colors = ("pink", "purple", "green", "blue") #Python #DailyPythonTip
@
βEven though we typically use duck typing in Python, this is one of the few cases where we actually practice strong type-checking.β Read more π https://pym.dev/when-to-use-notimplemented/ #Python
@
πΊοΈ November 2, 2026 5/5 countries in 6/13 guesses π‘π’π’π’π’ whereabouts.earth/daily/ #Whereabouts https://whereabouts.earth/daily/
@
Python Tip #305 (of 365): Split only as much as you need with maxsplit. π§΅ Do this: key, value = line.split("=", maxsplit=1) Not this: key, *rest = line.split("=") value = "=".join(rest) #Python #DailyPythonTip
@
βCompared to the very slow tracing profiler, the sampling profiler has basically no overhead at all.β Read more π pym.dev/python315/ #Python https://pym.dev/python315/
@
πΊοΈ November 1, 2026 5/5 countries in 7/13 guesses π π’π’π’π’ whereabouts.earth/daily/ #Whereabouts https://whereabouts.earth/daily/
@
Python Tip #304 (of 365): Import the whole module when a name isn't clear. π§΅ Do this: import random color = random.choice(colors) Not this: from random import choice color = choice(colors) #Python #DailyPythonTip https://pym.dev/4-ways-import-module-python/
@
πΊοΈ October 31, 2026 5/5 countries in 6/13 guesses π’π’π’π‘π’ whereabouts.earth/daily/ #Whereabouts https://whereabouts.earth/daily/
@
Python Tip #303 (of 365): Remember that strings are iterables of strings. π§΅ Python doesn't have a character type, which usually makes things easier. If name is a string, name[0] returns a string, and strings have a lower method: >>> name = "Ada" >>> name[0].lower() 'a' #Python #DailyPythonTip
@
πΊοΈ October 30, 2026 5/5 countries in 6/13 guesses π‘π’π’π’π’ whereabouts.earth/daily/ #Whereabouts https://whereabouts.earth/daily/
@
Python Tip #302 (of 365): Use // instead of truncating with int. π§΅ Do this: mid_point = len(sequence) // 2 Not this: mid_point = int(len(sequence) / 2) #Python #DailyPythonTip
@
βIn Python 3.15, the open function uses UTF-8 as its default encoding on every operating system, so a file written on one machine reads the same on every other machine.β Read more π pym.dev/python315/ #Python https://pym.dev/python315/
@
πΊοΈ October 29, 2026 5/5 countries in 5/13 guesses π’π’π’π’π’ whereabouts.earth/daily/ #Whereabouts https://whereabouts.earth/daily/
@
Python Tip #301 (of 365): Don't delete "unnecessary" syntax that makes code more readable. π§΅ Some code is unnecessary but NOT unhelpful: def earliest_date(date1, date2): if parse(date1) < parse(date2): return date1 else: return date2 #Python #DailyPythonTip https://pym.dev/unnecessary-else-statements/
@
βIn Python, it's not always easy to tell the difference between a class and a function...β Read more π https://pym.dev/class-or-function/ #Python
@
I just launched a Python Morsels course: Lazy Looping in Python π Learn to build your own looping helpers with generators, iterators, and itertools. It also includes a Daily Recall pack: spaced repetition that unlock as you progress, so you actually REMEMBER what you learn. Section 1 is free! π https://www.pythonmorsels.com/courses/lazy-looping/overview/
@
πΊοΈ October 28, 2026 5/5 countries in 6/13 guesses π’π’π’π‘π’ whereabouts.earth/daily/ #Whereabouts https://whereabouts.earth/daily/
@
Python Tip #300 (of 365): Separate the steps of a function with blank lines. π§΅ If you're using an auto-formatter like ruff or Black, you won't have control over most of your whitespace. But how you use blank lines within functions is still up to you. #Python #DailyPythonTip https://pym.dev/embrace-whitespace/
@
βThe utilities in the textwrap module are meant to operate on text that represents just one paragraph.β Read more π pym.dev/wrapping-text/ #Python https://pym.dev/wrapping-text/
@
πΊοΈ October 27, 2026 5/5 countries in 6/13 guesses π’π’π’π’π‘ whereabouts.earth/daily/ #Whereabouts https://whereabouts.earth/daily/