[Python-3000] Support for PEP 3131
Rauli Ruohonen
rauli.ruohonen at gmail.com
Sun Jun 3 10:31:30 CEST 2007
On 6/3/07, Jim Jewett <jimjjewett at gmail.com> wrote:
> On 6/2/07, Rauli Ruohonen <rauli.ruohonen at gmail.com> wrote:
> > # identifier_charset: 0-7f
>
> Why not ASCII?
> Why not be more specific, with 0x30-0x39, 0x41-0x5a, 0x5f, 0x61-0x7a
>
> When adding characters, this isn't such a problem. When restricting
> them, a standard spelling is more important.
I followed Stephen Turnbull's convention of only adding additional
restrictions to those already provided by PEP 3131. Here 0-7f would
block out all non-7-bit characters, and within that range the PEP
rule is "Within the ASCII range (U+0001..U+007F), the valid characters
for identifiers are the same as in Python 2.5."
> > #!/usr/bin/env python
> >
> > # Real code.
>
> > This isn't really anything more than a countermeasure against Ka-Ping's
> > tricky.py -exploit
>
> uhh... I don't see any charset comment there, so his coding: with a
> non-ASCII letter in "coding" would still work.
If it came in the comments before the first empty line, then it would cause a
syntax error, because non-ASCII wouldn't be allowed there to prevent such
trickery. The "first empty line" rule was there to make the safe area visually
clear to the reader.
More information about the Python-3000
mailing list