3 ms·
But apart from being "Internet compatible", it makes little sense to move from ascii only to utf-8. It only makes sense if you're already trying to deal with st
by e12e 11y ago
But apart from being "Internet compatible", it makes little sense to move from ascii only to utf-8. It only makes sense if you're already trying to deal with stuff that doesn't fit in ascii. Don't get me wrong, I think ascii was a terrible hack (I seem to recall one of the designers called it his biggest mistake/regret - and that they should've gone with some kind of prefix-encoding).
But the thing with unicode-everywhere is that it's more beginner friendly: you can have unicode in your variable names, and strings without giving it another thought.
$ cat u.py
from __future__ import print_function
å="æ"
print(å)
$ python2 u.py
File "u.py", line 2
SyntaxError: Non-ASCII character '\xc3'
in file u.py on line 2, but no
encoding declared;
see http://python.org/dev/peps/pep-0263/
for details
$ python3 u.py
æ
Sure, the explanation of what's wrong is right there in the
error-message, but it seems a bit of an unnecessary hurdle for people to
get around to write important programs, that ask you to type in your
name, and then prints out the name ten times ;-)