[Python-Dev] PEP for RFE 46738 (first draft)

Josiah Carlson jcarlson at uci.edu
Sun Jun 19 03:03:58 CEST 2005


Simon Wittber <simonwittber at gmail.com> wrote:
> > Why this discussion of yet another serialization format?
> 
> Pickle is stated to be unsafe. Marshal is also stated to be unsafe.
> XML can be bloated, and XML+gzip is quite slow.
> 
> Do size,speed, and security features have to mutually exclusive? No,
> that possibly is why people have had to invent their own formats. I
> can list four off the top of my head:

...


Looks to me like the eval(repr(obj)) loop spanks XMLRPC.  It likely also
spanks Gherkin, but I'm not one to run untrusted code.  Give it a shot
on your own machine.  As for parsing, repr() of standard Python objects
is pretty easy to parse, and if you want something a bit easier to read,
there's always pprint (though it may not be quite as fast).


 - Josiah

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> value = (("this is a record",1,2,1000001,"(08)123123123","some moretext")*10000)
>>> import time
>>> t = time.time();y = repr(value);time.time()-t
0.030999898910522461
>>> t = time.time();z = eval(y);time.time()-t
0.26600003242492676
>>> import xmlrpclib
>>> t = time.time();n = xmlrpclib.dumps(value);time.time()-t
0.42100000381469727
>>> t = time.time();m = xmlrpclib.loads(n);time.time()-t
4.4529998302459717
>>>



More information about the Python-Dev mailing list