Benefits of unicode identifiers (was: Allow additional separator in identifiers)

Ned Batchelder ned at nedbatchelder.com
Fri Nov 24 17:46:55 EST 2017


On 11/24/17 5:26 PM, Richard Damon wrote:

> Have you tried using U+2010 (HYPHEN) ‐. It is in the class 
> XID_CONTINUE (in fact it is in XID_START) so should be available.

U+2010 isn't allowed in Python 3 identifiers.

The rules for identifiers are here: 
https://docs.python.org/3/reference/lexical_analysis.html#identifiers 
.   U+2010 is in category Pd 
(http://www.fileformat.info/info/unicode/char/2010), which isn't one of 
the categories allowed in identifiers.  Category Pc 
(http://www.fileformat.info/info/unicode/category/Pc/list.htm) is 
allowed, but it doesn't include anything that would look like a hyphen.

--Ned.





More information about the Python-list mailing list