overriding methods - two questions
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Fri Nov 16 12:22:51 EST 2007
More information about the Python-list mailing list
Fri Nov 16 12:22:51 EST 2007
- Previous message (by thread): overriding methods - two questions
- Next message (by thread): overriding methods - two questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): overriding methods - two questions
- Next message (by thread): overriding methods - two questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list