Post

🏆 Top 5 Python 3.15 features to start using today: 1. Lazy imports 2. New built-in `frozendict` 3. New built-in `sentinel` 4. Unpacking inside comprehensions 5. New sampling profiler Tachyon What's your top Python 3.15 new feature?

I think my top 5 are: 1. UTF-8 as the default encoding on Windows 2. The new sentinel type 3. Unpacking in comprehensions: [*sub for sub in nested] 4. The new sampling profiler 5. pprint's new expand=True But it's hard to choose!

Basically Windows has been reading/writing with an encoding of cp1252 by default for forever. Both it and utf-8 are ASCII supersets but DIFFERENT ones. Valid text in cp1252 can result in errors or emojibake in utf-8 and vice versa. It's a cross-platform mess. And once 3.14 is EOL'd it'll be done.

IIRC, look at the docs for open and the notes on the default value for encoding. It mentions some module’s function like sys.getdefaultencoding (making this up!) or some such.

Awesome. Summary of my excitement: almost no one specifies encoding="utf-8" in all their open() calls... and now they don't have to! Looking forward to your 15 days of posts!