Not all Unicode codepoints are supported by unicodedata.name(), but
they are supported in \N escapes and unicodedata.lookup. Is there a
reason for this?

Normally, you can do this:

>>> "\N{GREEK SMALL LETTER OMEGA}"
'ω'
>>> unicodedata.name(_)
'GREEK SMALL LETTER OMEGA'

But check this out:

>>> unicodedata.lookup("CHARACTER TABULATION")
'\t'
>>> "\N{CHARACTER TABULATION}"
'\t'
>>> unicodedata.name(_)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: no such name
>>> unicodedata.lookup("NULL")
'\x00'
>>> "\N{NULL}"
'\x00'
>>> unicodedata.name(_)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: no such name

Tested on 3.4, 3.5, and 3.6. Extremely odd.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to