add indexes on the fly to lists

Gabriel B. gabriel.barros at gmail.com
Mon Jan 24 16:27:55 EST 2005


I wanted to make a list index work as the index of the data in the
database. something like

database:
idx
item_description
item_value

being imported to my program as:
x[idx][0]= item_description
x[idx][1]= item_value

the problem is that there will be some hundred items and possible the
idx wil vary from 1 to 600 (it's not linear as items got deleted the
idx should not be reused)

will it still be an easy solution or just a waste of resources (having
a 600-sized list for 100 elements)

I'm very new to python and apreciate any hints on that.

Thanks
Gabriel



More information about the Python-list mailing list