What is the fastest way to check for the existence of certain types in a list?
I would like to do the following:
class Generic(object) ... def ... class SubclassOne(Generic) ... def ... class SubclassOne(Generic) ... def ... thing_one = SubclassOne() thing_two = SubclassTwo() list_of_stuff = [thing_one, thing_two] if list_of_stuff.__contains__(SubclassOne): print "Yippie!"
EDIT: Trying to stay in the python 2.7 world. But 3.0 solutions will be fine!
visc source share