Efficient searching through objects

sert jerry at hotmail.com
Thu Feb 26 06:50:22 EST 2009


I have written a program that reads data and updates the records 
for some people. They are represented by objects, and I need to 
read the data from a file, look the person up and then update 
his record.

I have implemented this by creating a list with all the people's 
names and another list with their objects (their data).

It works but after profiling the code it turns out that half the 
time spent in the program is spent in the list.index() function 
looking up names. Isn't there a less goofy and more efficient 
way of doing this?



More information about the Python-list mailing list