[Python-3000] Support for PEP 3131

Jim Jewett jimjjewett at gmail.com
Sat May 26 18:00:02 CEST 2007


On 5/25/07, Blake Winton <bwinton at latte.ca> 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.

> 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

> So, what are you doing to mitigate this risk now, and why not do the
> same thing when identifiers are allowed to be arbitrary Unicode?

Looking at foo.py, I didn't even realize at first that it was supposed
to be a lookaline for triple-quotes; in my font, it is different
enough to draw the eye and tell me that something is wrong.

I don't like counting on that, but it does work -- for ASCII.  It
stops working with unicode, because the glyphs are even closer (or
identical).

This is partly a historical accident -- ASCII has been used long
enough that there are widespread fonts (including the most common
monospaced fonts) which make the distinctions fairly clear, and I'm
already trained to look for the edge cases.

Neither of these safeguards is true for unicode, nor will they become
true in the forseeable future.  Given the sheer size of unicode, these
safeguards may never become available in the general case -- but we
already have them for ASCII.

-jJ


More information about the Python-3000 mailing list