super. could there be a simpler super?

Gonçalo Rodrigues op73418 at mail.telepac.pt
Thu Jan 15 09:15:29 EST 2004


On Thu, 15 Jan 2004 11:50:57 +0300, Kerim Borchaev <warkid at hotbox.ru>
wrote:

>Hello!
>
>  Always when I use "super" I create a code duplication because class
>  used as first arg to "super" is always the class where the method
>  containing "super" was defined in:
>  '''
>  class C:
>      def method(self):
>          super(C, self).method()
>  '''
>
>  Obviously the methods like the one below doesn't work "right";-)
>  '''
>  def super(self):
>      super(self.__class__, self)
>  class C:
>      def method(self):
>          super(self).method()
>  '''

Hmm... I once used super where the class used as first arg was *not*
the class defining the method, it was it's super class. So I was
calling, not the super method, but it's grand-super method.

Arguably, this is a clear sign of bad design on my part. But that's
how it went, anyway.

With my best regards,
G. Rodrigues




More information about the Python-list mailing list