colloquial names for types?

holger krekel pyth at devel.trillke.net
Sun Aug 25 13:18:23 EDT 2002


Andrew Koenig wrote:
> Is there an easy way to determine the colloquial name of an object's
> type?  By "colloquial name" I mean the name by which one would refer
> to it in casual conversation.  For example, the colloquial type of 3
> is "int", not "<type 'int'>", and the colloquial type of a class is
> the name of the class, not including the module in which the class is
> defined.
> 
> I understand that such names can be ambiguous.  However, they are
> useful for printing human-readable representations of complicated
> data structures.

I'd try using

    something.__class__.__name__




More information about the Python-list mailing list