Question about isinstance()
roccomoretti at hotpop.com
Thu Jan 26 23:58:44 CET 2006
> All in all it seems that the implementation that uses isinstance() is
> better in this case...
Well what's "better" depends on what you want to happen when you compare
an unrelated class that also defines 'an_attribute'. Unlike in
statically typed languages, certain things are made easier when you
don't check for strict inheritance (like mock and proxy objects). Google
"Duck Typing" for more info.
More information about the Python-list