Getting class name
Michael Hudson
mwh at python.net
Fri Aug 29 11:50:47 EDT 2003
Travis Whitton <whitton at atlantic.net> writes:
> Hello all,
> I've googled a bit, and I've failed to find an answer to this question. Is it
> possible to get a classes name from inside of a class? I.e.,
>
> class Foo:
> def print_classname(self):
> # somehow print Foo
print self.__class__.__name__
?
Cheers,
mwh
--
MARVIN: Do you want me to sit in a corner and rust, or just fall
apart where I'm standing?
-- The Hitch-Hikers Guide to the Galaxy, Episode 2
More information about the Python-list
mailing list