On 2009-06-07 15:41, Tuomas Vesterinen wrote:
Kless wrote:
Is there any way of to get the class name to avoid to have that write
it?

---------------
class Foo:
super(Foo, self)
---------------


* Using Py 2.6.2

 >>> class Foo(object):
... def cls(self):
... return self.__class__
...
 >>> Foo().cls()
<class '__main__.Foo'>

You definitely don't want to use that for super(). If you actually have an instance of a subclass of Foo, you will be giving the wrong information. Basically, there is no (sane) way to do what the OP wants. If there were, that information would not be necessary to give to super().

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to