[Tutor] (de)serialization questions

Albert-Jan Roskam fomcl at yahoo.com
Thu Sep 30 21:46:47 CEST 2010


I have data about zip codes, street and city names (and perhaps later also of 
street numbers). I made a dictionary of the form {zipcode: (street, city)}
I dumped the dictionary into a marshal file. I have two questions:

The first question is a very basic one: if I deserialize the dictionary it is 
placed into memory. This is fast, but can cause problems for very large objects. 
Are there forms of object permanence that do not read all data into memory? Does 
the shelve module work this way?

Second, does anybody know of a speed comparison test (e.g., web source) of 
various de/serialization methods? I don't mind if the dumping is somewhat slow. 
Fast loading speed is more important for my purpose.

Btw, I am aware of the portability problems of marshal files. I found that, 
compared to a shelve object, dumping is *much* faster,  loading is slightly 
faster,  look-ups are scarily fast, and file size is about half. 

I am using Python 2.5 and installing non-standard modules is a problem for the 
IT droids in my office.


All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a fresh water system, and public health, what have the 
Romans ever done for us?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100930/1fea82a9/attachment.html>

More information about the Tutor mailing list