Does Python 3.x support Unicode-named attributes?
"Martin v. Löwis"
martin at v.loewis.de
Thu Nov 19 21:21:48 CET 2009
> Does Python 3.x support Unicode-named attributes?
Most certainly, yes. All identifiers (and thus all attribute
names) are Unicode strings in Python 3.x.
> There are several modules which operate on HTML and try to
> hammer HTML/XML into Python object attributes. I've had
> BeautifulSoup and "urllib" blow up at various times when
> running on non-English HTML/XML.
> Got this error today:
> urllib.py:1197: UnicodeWarning: Unicode equal comparison failed to
> convert both arguments to Unicode - interpreting
> them as being unequal
> res = map(safe_map.__getitem__, s)
Perhaps the library you were using modified __dict__ directly,
thus getting non-string attribute names into the dict? Or perhaps
s is not a Unicode string?
More information about the Python-list