Finding the name of a class
Kent Johnson
kent at kentsjohnson.com
Tue Aug 1 14:36:48 EDT 2006
Kirk Strauser wrote:
> Larry Bates wrote:
>
>> print print b.__class__.__name__ gives what you want
>
> That doesn't seem to do it, though. Here's the result of importing a module
> from my company's internally-developed library:
>
>>>> from Daycos.TableCopier.copyfro import StateProcessor
>>>> print StateProcessor.__class__.__name__
> type
>
> I'm looking for something that would print 'StateProcessor' but am not
> having much luck.
It looks like StateProcessor is a class; StateProcessor.__class__ is the
class of a class, i.e. type. Try
StateProcessor.__name__
Kent
More information about the Python-list
mailing list