"Find" in list of objects

Andreas Müller hufflehuffle at west.de
Thu Oct 23 03:23:51 EDT 2008


Hi!

(Python 2.2.3 if this is relevant :-)

I have a list of objects with, lets say, the attributes "ID", "x" and
"y". Now I want to find the index of list element with ID=10.

Of course I can loop through the list manually, but is there a
construct like

list.find (10, key='ID')

? Thanks for your ideas.

Best regards,
Martin






More information about the Python-list mailing list