bdb: which class?

Stefan Schwarzer s.schwarzer at ndh.net
Thu Jan 6 11:50:01 EST 2000


Hello,

"Zakon, Stuart" schrieb:
> I would like to have the class name for methods of classes which are being
> called but I didn't see it in the documentation for code objects.
> Anybody know if this can be found?

If I understand your question: What about

class where_am_i:
    def name( self ):
        'return the name of the class to which self belongs'
        return self.__class__.__name__

? This should also work, if the object identified by self belongs to
a class Derived, i. e. 'Derived' should be returned.

Stefan



More information about the Python-list mailing list