Non-ASCII Python identifiers and reflectivity [dup

2019-04-06 10:23发布

I have learnt from PEP 3131 that non-ASCII identifiers were supported in Python, though it's not considered best practice.

However, I get this strange behaviour, where my

1条回答
趁早两清
2楼-- · 2019-04-06 10:42

Per the documentation on identifiers:

All identifiers are converted into the normal form NFKC while parsing; comparison of identifiers is based on NFKC.

You can see that U+03C4 is the appropriate result using unicodedata:

>>> import unicodedata
>>> unicodedata.normalize('NFKC', '                                                                    
查看更多
登录 后发表回答