sert: > 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?
Try using a dict instead, where keys are the names and objects the values (it turns a linear search in a quick hash look up). . Then tell us the performance changes. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list