

#424 We Will Test in Production
17 snips Mar 17, 2025
Discover the peculiarities of Python's rounding mechanism, where numbers ending in .5 round to the nearest even integer. Dive into performance enhancements thanks to tail call optimization, promising up to 10% speed improvements in upcoming releases. Learn practical techniques for string manipulation to easily remove punctuation. Plus, enjoy a humorous take on the risks of testing in production, underscored by a clever Star Trek analogy. All this, sprinkled with insights on Python infrastructure and startup opportunities!
AI Snips
Chapters
Transcript
Episode notes
Python's Rounding Quirk
- Python's round() function has a quirk: numbers ending in .5 always round to the nearest even number.
- This follows IEEE 754 and is known as banker's rounding.
Python Adds Tail Calls
- Python 3.14 will include tail calls, improving performance by up to 40% in some cases.
- This optimization is comparable to the gains of two minor CPython releases.
Efficient Punctuation Removal
- Use
translate
andmaketrans
to efficiently remove punctuation from strings in Python. - Avoid using
replace
for this task, as it's less efficient.