Lists and Sublists

dineshv dinesh.vadhia at theworkssoftware.com
Tue Oct 23 17:44:29 EDT 2007


We have a list of N (>2,000) keywords (of datatype string).  Each of
the N keywords has associated with it a list of names of varying
numbers.  For example, keyword(1) will have a list of L1 names
associated with it, keyword(2) will have a list of L2 names associated
with it and so on with L1 not equal to L2 etc.  All keywords and names
are immutable.

Given a keyword(n) , we want to get hold of the associated list of Ln
names.

At anytime, we also want to add keywords to the list of N keywords,
and to any of the associated Ln lists - both of which will grow to
very large sizes.

The data will be read into the Python data structure(s) from disk
storage.

I am struggling to work out what is the ideal Python data structure
for the above.  Any help would be greatly appreciated.

Dinesh




More information about the Python-list mailing list