Finding the name of a class

Edward C. Jones edcjones at erols.com
Wed May 12 21:43:47 EDT 2004


Erik Max Francis wrote:
> "Edward C. Jones" wrote:
>>Is there a function or method that returns the name of a class or
>>class
>>instance?
>> ...
>
 > ...
> Use the __name__ attribute:


Thanks. Once I knew the answer, I had no trouble finding it in the 
documentation. See Library Reference, 3.11.1 or Reference Manual 3.2. I 
didn't find it because "__name__" is not listed in dir(X) or dir(X()).



More information about the Python-list mailing list