List or Dictionairy or neither?

Dietmar Lang dietmar at wohnheim.fh-wedel.de
Fri Aug 17 06:08:25 EDT 2001


Greetings, fellow Pythoneers,

I am currently working on an application that works with a simple, but
relatively large data structure: a large list, with its items being
strings, 3-4 lines long each.

Now the list is shelved and I am accessing its items pretty randomly.
I've found the access times to be rather slow. So my questions are:

- Would using a dictionary make access faster?

- Is there a faster method for saving and accessing my stuff?

- Would saving the data as one big text file with separators/indexes and
a good search algorithm be faster? (Since my strings won't exceed a
certain length, maybe defining a max size for each item and then seeking
into the file with, say, 5-line distances?)

Thanks a lot for your help,

Dietmar



More information about the Python-list mailing list