Lists, tuples and memory.
Roy Smith
roy at panix.com
Thu Jul 15 16:31:53 EDT 2004
"Larry Bates" <lbates at swamisoft.com> wrote:
> Any reason not to put the words into a dictionary?
> [...]
> I'll bet access is faster (even if loading is slightly slower).
One trick I've used when I have something with a long startup time
because it's parsing static files and building data structures is to
build the data structure once, then pickle it (see the pickle and
cPickle modules).
You production code then just has to call cPickle.load (file) and you're
up and running way faster than re-parsing the original data files.
More information about the Python-list
mailing list