Message375449
On Fri, Aug 14, 2020 at 02:03:37PM +0000, Seth Woodworth wrote:
> I'm exploring what unicode code points can be used as valid starting
> characters for identifiers.
I presume you have seen the documention here:
https://docs.python.org/3/reference/lexical_analysis.html#identifiers
> I'm looping over the code point ranges
> with the XID_START property and attempting to add them to globals() to
> see if they maintain the same representation.
You can add any hashable key to globals, it's just a dict:
py> globals()[2] = 'test'
py> globals()[2]
'test'
Including strings that differ in their normalization:
py> import unicodedata
py> phi = 'ϕ'
py> nphi = unicodedata.normalize('NFKC', phi)
py> g = globals()
py> g[phi] == g[nphi]
False
The strings are only normalised when used as variables:
py> eval(f'{phi} == {nphi}')
True |
|
Date |
User |
Action |
Args |
2020-08-15 05:31:31 | steven.daprano | set | recipients:
+ steven.daprano, vstinner, ezio.melotti, tianrluo, sethwoodworth |
2020-08-15 05:31:31 | steven.daprano | link | issue41542 messages |
2020-08-15 05:31:31 | steven.daprano | create | |
|