----- Original Message -----

> From: eryksun <eryk...@gmail.com>
> To: tutor@python.org
> Cc: 
> Sent: Saturday, May 18, 2013 5:28 AM
> Subject: Re: [Tutor] why is unichr(sys.maxunicode) blank?
> 
> On Fri, May 17, 2013 at 11:06 PM, Dave Angel <da...@davea.name> wrote:
>>  One tool that can help is the name function in module unicodedata
>> 
>>   >>> import unicodedata
>>   >>> unicodedata.name(u'\xb0')
>>  'DEGREE SIGN'
>> 
>>  If you try that on the values near sys.maxunicode you get an exception:
>>  ValueError: no such name
> 
> There's no name since the code point isn't assigned, but the category
> is defined:
> 
>     >>> unicodedata.category(u'\U0010FFFD')
>     'Co'
>     >>> unicodedata.category(u'\U0010FFFE')
>     'Cn'
>     >>> unicodedata.category(u'\U0010FFFF')
>     'Cn'
> 
> 'Co' is the private use category, and 'Cn' is for codes that 
> aren't assigned.

Thank you. That unicodedata module is very handy sometimes (and crucial for 
regexes, sometimes). I rarely use it but I should have remembered it.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to