> Unless I misunderstood the question, that won't work. That will
> give you the name of the class the object is an instance is of.
> I think he wants the name of the class the method was defined in.

Where is the difference? The method is defined in a class - and an instance
is created from that class.

This works as expected:

class ExistentialCrisis:
    def __init__(self, text):
        self.spam = text
        print 'In the constructor of the %s class' % self.__class__.__name__


ExistentialCrisis("egal")


-- 
Regards,

Diez B. Roggisch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to