Why doesn't python3 care about non-ascii characters in source file?

Viewed 434

Suppose I have a .py file with the following contents

print('(ノಠ益ಠ)ノ彡┻━┻')

When called by python3 it prints the angry guy flipping a table, however on python2 we get SyntaxError and need to add a declaration line like # coding: utf-8 in the file to run it.

My question is why doesn't python 3 care about non-ascii characters? I don't see any description of that in PEP 0263. How does the interpreter guess the encoding of the file correctly when I didn't specify that, where is the behaviour documented?

1 Answers
Related