What is the class of myobj?

Erik Max Francis max at alcyone.com
Wed Oct 16 18:07:02 EDT 2002


JXStern wrote:

> Especially that last one never occured to me, eg:
> 
> >print MyClass
> __main__.MyClass

Note that isinstance is preferred if you want to respect the class
hierarchy; isinstance(x, X) will be true if X is the x's class or any of
its parent classes.  In this code fragment it obviously doesn't matter,
but in some cases you will want that extra functionality.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Ride / Ride this wave of mine
\__/ Res
    Sade Deluxe / http://www.sadedeluxe.com/
 The ultimate Sade encyclopedia.



More information about the Python-list mailing list