Donn Ingle: > Say I am in class Basis, doing a loop and I have a list of Child objects. I > want to run the foo() method for each one that *has* a foo() method.
This may help (on an old Python version): >>> class Sam: pass ... >>> class Judy: ... def foo(self): pass ... >>> children = [Sam(), Judy(), Sam()] >>> for child in children: hasattr(child, "foo") ... False True False Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list