Convert string to command..

Hrvoje Niksic hniksic at xemacs.org
Thu Oct 18 12:30:00 EDT 2007


Abandoned <besturk at gmail.com> writes:

> I select where id=56 and 100.000 rows are selecting but this took 2
> second. (very big for my project)
> I try cache to speed up this select operation..
> And create a cache table:
> id-1 | all
> 56    {68:66, 98:32455, 62:655}

If you use Python to create this cache table, then simply don't dump
it as a dictionary, but as a pickle:

id-1 | all
56     <some weird string produced by cPickle.dumps>

When you load it, convert the string to dict with cPickle.loads
instead of with eval.



More information about the Python-list mailing list