Hacker News new | past | comments | ask | show | jobs | submit login

Reading and writing files. This catches people out, because on most Linux and Mac systems it defaults to UTF-8, so people assume UTF-8 is the default. But it's based on the locale, so one day someone runs your code on Windows, or on Linux with the basic ANSI C locale, and suddenly writing text to a file blows up.

This is the number one thing I'd change if I were in charge of Python. ;-)




I would actually rather change it to make the encoding required when opening a text file. Sometimes you do want UTF-8, but other times you do actually want locale encoding (because other text processing tools expect locale). And then "Explicit is better than implicit".

That said, .NET has been defaulting to UTF-8 for text files since 1.0, and it seems to be working well in practice, so maybe it is a reasonable default after all.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: