This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients ezio.melotti, steven.daprano
Date 2013-08-01.13:54:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375365245.12.0.441428484785.issue18614@psf.upfronthosting.co.za>
In-reply-to
Content
As per the discussion here:

http://mail.python.org/pipermail/python-ideas/2013-July/022419.html

\N{} escapes should support the Unicode code point notation U+xxxx (where there are four, five or six hex digits after the U+).

E.g. '\N{U+03BB}' => 'λ'

unicodedata.lookup should also support such numeric names, e.g.:

unicodedata.lookup('U+03BB') => 'λ'

As '+' is otherwise prohibited in Unicode character names, there should never be ambiguity between 'U+xxxx' as a code point and an actual name, and a single lookup function can handle both.

(See http://www.unicode.org/versions/Unicode6.2.0/ch04.pdf#G39 for details on characters allowed in names.)


Also add a function for the reverse

unicodedata.codepoint('λ') => 'U+03BB'


def codepoint(c):
    return 'U+{:04X}'.format(ord(c))
History
Date User Action Args
2013-08-01 13:54:05steven.dapranosetrecipients: + steven.daprano, ezio.melotti
2013-08-01 13:54:05steven.dapranosetmessageid: <1375365245.12.0.441428484785.issue18614@psf.upfronthosting.co.za>
2013-08-01 13:54:05steven.dapranolinkissue18614 messages
2013-08-01 13:54:04steven.dapranocreate