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

Richard Damon Richard at Damon-Family.org
Fri Nov 24 18:31:28 EST 2017


On 11/24/17 5:46 PM, Ned Batchelder wrote:
> 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.
>
>
Looks like the site that I looked up characters in XID_CONTINUE/START 
was incorrect. Looks like not only is U+2010 not in any of the character 
classes that are put into ID_START or ID_CONTINUE but is in 
Pattern_Syntax which is explicitly removed from those categories.

-- 
Richard Damon




More information about the Python-list mailing list