Invalid identifier claimed to be valid by docs (methinks)
Joshua Landau
joshua.landau.ws at gmail.com
Sun Sep 23 18:24:46 EDT 2012
The docs describe identifiers to have this grammar:
*identifier * ::= xid_start
<http://docs.python.org/py3k/reference/lexical_analysis.html#grammar-token-xid_start>
xid_continue <http://docs.python.org/py3k/reference/lexical_analysis.html#grammar-token-xid_continue>**id_start
* ::= <all characters in general categories Lu, Ll, Lt, Lm, Lo,
Nl, the underscore, and characters with the Other_ID_Start
property>*id_continue * ::= <all characters in id_start
<http://docs.python.org/py3k/reference/lexical_analysis.html#grammar-token-id_start>,
plus characters in the categories Mn, Mc, Nd, Pc and others with the
Other_ID_Continue property>*xid_start * ::= <all characters in
id_start <http://docs.python.org/py3k/reference/lexical_analysis.html#grammar-token-id_start>
whose NFKC normalization is in "id_start xid_continue*">*xid_continue*
::= <all characters in id_continue
<http://docs.python.org/py3k/reference/lexical_analysis.html#grammar-token-id_continue>
whose NFKC normalization is in "id_continue*">
So I would assume that
exec("a{} = None".format(char))
would be valid if
unicodedata.normalize("NFKC", char) == "1"
as
exec("a1 = None")
is valid.
BUT "a¹ = None" is not valid*.
*a<superscript 1>, accessible through <ALT-GR>+1 if your keyboard's set up
to do that stuff.
Thank you for your times.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120923/3c6e4035/attachment.html>
More information about the Python-list
mailing list