Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Does Python 3.x support Unicode-named attributes?

Reply
Thread Tools

Does Python 3.x support Unicode-named attributes?

 
 
John Nagle
Guest
Posts: n/a
 
      11-19-2009
Does Python 3.x support Unicode-named attributes?

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)

John Nagle


 
Reply With Quote
 
 
 
 
Martin v. L÷wis
Guest
Posts: n/a
 
      11-19-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?

Regards,
Martin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What does "driver does not support your hardware" mean? John Ritchie Computer Information 2 08-04-2007 04:59 AM
Does the Python/C interface support Queue objects? scott.manton@gmail.com Python 1 05-05-2005 05:48 PM
Does python support multi prototype. angel Python 9 08-09-2004 04:41 AM
does python support mvc architecture ketulp_baroda@yahoo.com Python 4 02-12-2004 07:05 PM
Python.h problem-> /usr/include/python2.2/longobject.h:48: warning: ISO C89 does not support `long long' Christian Seberino Python 8 02-11-2004 05:39 PM



Advertisments