Question about isinstance()

Rocco Moretti roccomoretti at
Thu Jan 26 23:58:44 CET 2006

Mr.Rech wrote:
> 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 mailing list