What kind of class does my instance belong too?
mfletch at tpresence.com
Mon Nov 13 18:23:38 CET 2000
isinstance( object, class )
# also checks for sub-classes, so your check would need to be for the
subclass, not for the superclass...
if self.__class__ == Spam:
# more fragile, since only _exactly_ this class is accepted
From: Peter Stöhr [mailto:peter.stoehr at fh-hof.de]
Sent: Monday, November 13, 2000 1:14 PM
To: python-list at python.org
Subject: What kind of class does my instance belong too?
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
More information about the Python-list