How to get/set class attributes in Python
Chris Spencer
usenet.20.evilspam at spamgourmet.com
Sun Jun 12 14:06:46 EDT 2005
Bruno Desthuilliers wrote:
> And *this* is highly unpythonic. And un-OO too, since it makes foo()
> dependant on *class* Bar, when it should most probably be enough that it
> only depends on (probably part of) the *interface* of class Bar.
I was providing the original poster with a simple way to ensure
appropriate type. You can assert whatever aspect you wish. If you want
to ensure compatibility with some other property simply use "assert
blah" subsituting blah for whatever test you wish to perform (e.g.
assert MyInterface.implementedBy(bar) to test for interface implementation).
More information about the Python-list
mailing list