[Python-3000] PEP 3131 - the details
"Martin v. Löwis"
martin at v.loewis.de
Thu May 17 10:51:19 CEST 2007
> Some questions I have: is the defined UID set the same as in the referenced
Yes; it was copied from there.
> Is it the same as in Java (and hence Jython)?
No. Not sure whether I can produce a complete list of differences, but
some of them are:
- Java allows $ in identifiers, the PEP doesn't (as is Python tradition)
(more generally: it allows currency symbols in identifiers)
- Java allows arbitrary connecting punctuators as the start; the PEP
only allows the underscore
- Java allows "arbitrary" digits in an identifier. I'm not quite sure
what that means: JLS refers to isJavaIdentifierPart, which specifies
"a digit" and refers to isLetterOrDigit, which refers to JLS. isDigit
gives true if the character NAME contains DIGIT, and the digit is
not in the range U+2000..U+2FFF
The PEP specifies that digits need to have the Nd class.
Comparing these two, it seems that Java allows several characters from
the No class, which Python does not allow.
- Java allows "ignorable control characters" in identifiers, which
Python doesn't allow.
So, in short, it seems that Python's identifier syntax would be strictly
more restrictive than Java's.
> The same as in .NET (and hence IronPython)?
This kind of research is time consuming; it cost me an hour to come
up with above list. Please research it for yourself.
More information about the Python-3000