Python & unicode

Kent Johnson kent3737 at
Tue Jan 11 07:58:19 EST 2005

michele.simionato at wrote:
> I forgot to add the following:
>>>>setattr(C, "è", u"The letter è")
>>>>getattr(C, "è")
> u'The letter \xe8'
>>>>print getattr(C, "è")
> The letter è

But try this:
  >>> C.è
   File "<stdin>", line 1
SyntaxError: invalid syntax

> Python identifiers can be generic strings, including Latin-1
> characters;

I don't think so. You have hacked an attribute with latin-1 characters in it, but you haven't 
actually created an identifier.

According to the language reference, identifiers can only contain letters a-z and A-Z, digits 0-9 
and underscore.


More information about the Python-list mailing list