What kind of class does my instance belong too?
dbrueck at edgix.com
Mon Nov 13 18:26:07 CET 2000
> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Peter Stohr
> Sent: Monday, November 13, 2000 11:14 AM
> To: python-list at python.org
> Subject: What kind of class does my instance belong too?
> Hi out there in the python-universe,
> I'm having a small problem and after looking at the docs I
> was not able
> to solve it by myself. So maybe someone out there can help me.
> Lets assume I have create a class Spam and a class Eggs derived form
> class Spam.
> In one of the methods I have to implement a behaviours depending on
> whether a passed instance is an instance of class Spam or something
> different, for example:
> class Spam:
> class Eggs(Spam):
> def doSomething(self, aArg):
> if aArg is instance of Spam:
> What I try to figure out is what is the correct way to write such an
> if-statement ?
> I've tried the builtin function type(). The result <type
> 'instance'> is
> correct bit doesn't solve my problem :-(
> Thanks in advance
More information about the Python-list