[Python-3000] Support for PEP 3131 (original) (raw)

Ka-Ping Yee python at zesty.ca
Sat May 26 12:37:46 CEST 2007


On Fri, 25 May 2007, Blake Winton wrote:

Jim Jewett wrote: > Arbitrary Unicode identifier opens up the possibility of code that > looks like ASCII, but isn't -- so I don't even realize that I missed > something.

You already have that problem. Right now. And you've had it for at least a year (assuming you installed 2.4.3 when it came out). All screenshots taken on Python 2.4.3, Mac OSX 10.4 Intel. http://bwinton.latte.ca/temp/Python/File.png http://bwinton.latte.ca/temp/Python/Run.png http://bwinton.latte.ca/temp/Python/foo.py

Yes -- you have demonstrated exactly why the default encoding for Python files should be 7-bit ASCII, and why a coding declaration should be required to switch to other encodings, to let the reader know that the file might not contain what it appears to contain.

Your file, like tricky.py, relies on the invisible enabling of UTF-8 by a UTF-8-encoded BOM at the beginning of the file.

Switching to UTF-8 invisibly (or by default) is dangerous; enabling non-ASCII identifiers by default augments this problem to a whole new level. Neither should be the default.

-- ?!ng



More information about the Python-3000 mailing list