__name__

Michael Tiomkin michael at camelot-it.com
Sun Jan 16 08:19:09 EST 2000


  All the class info is a part of the class, and not of an object.  For an object a, you can use
a.__class__.name instead.

  Michael

JB wrote:

> Could anyone tell me how to get a classes name:
>
> class MyClass:
>    def className( self ):
>        return self.__name__
>
> This doesn't fly. The docs say a class has the __name__ attribute but...
>
> thanks
> jb
>
> --
> There are bugs and then there are bugs.  And then there are bugs.
> -- Karl Lehenbauer




More information about the Python-list mailing list