Confirmed users
513
edits
Klahnakoski (talk | contribs) |
Klahnakoski (talk | contribs) |
||
Line 167: | Line 167: | ||
=== Unicode in Python 2.7 === | === Unicode in Python 2.7 === | ||
Unicode, character encodings, and Python2.7 may be harder than timezones to debug if only because | Unicode, character encodings, and Python2.7 may be harder than timezones to debug if only because the terminal performs its own conversion to display the data structures you are viewing (is "é" in your IDE one bytes or two?). Two lines make internationalization easier in Python2.7: | ||
{| | {| | ||
Line 175: | Line 175: | ||
|} | |} | ||
The latter makes Python interpret untyped string constants as unicode; and I don't need | The latter makes Python interpret untyped string constants as unicode; and I don't need add explicit u"" everywhere. Also, the second line works well with the first so you do not end up with the nonsensical situation like <code>u"é" != "é".decode("latin1").encode("utf8")</code> | ||
=== PyPi and setup.py === | === PyPi and setup.py === |