my computer is allergic to pickles

Miki Tebeka miki.tebeka at gmail.com
Sun Mar 6 20:19:28 EST 2011


> Or, which situations does shelve suit better and which does
> marshal suit better?
shelve ease of use and the fact it uses the disk to store objects makes it a good choice if you have a lot of object, each with a unique string key (and a tuple of strings can be converted to and from a string).

db = shelve.open("/tmp/foo.db")
db["key1"] = (1, 2, 3)
...

Marshal is faster and IIRC more geared toward network operations. But I haven't used it that much ...



More information about the Python-list mailing list