[Python-Dev] hasattr() and Unicode strings
Thu, 07 Sep 2000 16:01:44 -0400
hasattr(), getattr(), and doubtless other built-in functions
don't accept Unicode strings at all:
>>> import sys
>>> hasattr(sys, u'abc')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: hasattr, argument 2: expected string, unicode found
Is this a bug or a feature? I'd say bug; the Unicode should be
coerced using the default ASCII encoding, and an exception raised if
that isn't possible.