Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

unicodedata.name

2 views
Skip to first unread message

Szabolcs Nagy

unread,
Feb 1, 2006, 11:43:21 AM2/1/06
to
the unicodedata manual sais:
"
name( unichr[, default])
Returns the name assigned to the Unicode character unichr as a
string. If no name is defined, default is returned, or, if not given,
ValueError is raised.
"
what is the difference between "no name defined" and "not given"?
eg. '\n' why gives a ValueError?

>>> unicodedata.name(u'\n')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: no such name

Fredrik Lundh

unread,
Feb 1, 2006, 12:06:33 PM2/1/06
to pytho...@python.org
Szabolcs Nagy wrote:

> the unicodedata manual sais:
> "
> name( unichr[, default])
> Returns the name assigned to the Unicode character unichr as a
> string. If no name is defined, default is returned, or, if not given,
> ValueError is raised.
> "
> what is the difference between "no name defined" and "not given"?

"no name is defined" refers to the unicode database, "not given"
refers to the default argument. if you don't specify a default, and
the character don't have a known name, you get a ValueError.

> eg. '\n' why gives a ValueError?
>
> >>> unicodedata.name(u'\n')
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> ValueError: no such name

the Unicode standard doesn't specify names for control characters.

</F>

Szabolcs Nagy

unread,
Feb 1, 2006, 12:40:08 PM2/1/06
to
thank you
(it's so obvious i don't know how i could misunderstand)

0 new messages