mercado mercado wrote:
In Python, is it possible for an instance method to know the name of the
class which is calling it?
Well, the class name is in __class__ so changing
'print x' to
'print __class__'
will show foo in both cases, which is in fact the name of the class
which is calling i
Le Friday 05 September 2008 17:29:39 mercado mercado, vous avez écrit :
> In Python, is it possible for an instance method to know the name of the
> class which is calling it? For example, in the sample below, I would like
> for the someMethod method to print the name of the class calling it ("bar"
In Python, is it possible for an instance method to know the name of the
class which is calling it? For example, in the sample below, I would like
for the someMethod method to print the name of the class calling it ("bar"
in the first case, "again" in the second).
-