K
Kless
Is there any way of to get the class name to avoid to have that write
it?
it?
.... def cls(self):Kless said:Is there any way of to get the class name to avoid to have that write
it?
... def cls(self):
... return self.__class__
...
<class '__main__.Foo'>
Is there any way of to get the class name to avoid to have that write
it?
Kless said:Is there any way of to get the class name to avoid to have that write
it?
FooFoo
Foo
The question does not make sense:
"to have WHAT write WHAT",
and the code is wrong:
the call to super fails
But even so, perhaps this will answer your question
>>> class Foo:
... pass
...
>>> print Foo.__name__
Foo
>>> c = Foo
>>> print c.__name__
Foo
>>> ob = Foo()
>>> print ob.__class__.__name__
Foo
Gary Herron
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.