XML, JSON, or what?
Daniel Dittmar
daniel.dittmar at sap.corp
Fri Jun 16 10:38:11 EDT 2006
> My client-server is Python-to-Python. At present, I am using cPickle to
> transfer objects between the two. Among other things, I sometimes
> transfer a tuple. Using JSON it appears on the other side as a list. As
> I sometimes use the tuple as a dictionary key, this fails, as you
> obviously cannot use a list as a key.
[...]
> Can someone confirm this, or is there an easy workaround?
You can always convert a list to a tuple using the tuple () builtin
right before you use it as a key. But you have to be sure that it is a
list. tuple ("abc") => ('a', 'b', 'c') is probably not what you intend
to do.
Daniel
More information about the Python-list
mailing list