Bugs item #1712419, was opened at 2007-05-04 00:49
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1712419&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Unicode
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Viktor Ferenczi (complex)
Assigned to: M.-A. Lemburg (lemburg)
Summary: Cannot use dict with unicode keys as keyword arguments
Initial Comment:
Unicode strings cannot be used as keys in dictionaries passed as keyword
argument to a function. For example:
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def fn(**kw):
... print repr(kw)
...
>>> fn(**{u'x':1})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: fn() keywords must be strings
>>>
Unicode strings should be converted to str automatically using the site
specific default encoding or something similar solution.
This bug caused problems when decoding dictionaries from data formats such as
XML or JSON. Usually unicode strings are returned from such modules, such as
simplejson. Manual encoding from unicode to str causes performance loss if this
cannot be done by Python automatically.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1712419&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com