On 29/04/07, James Y Knight <foom@fuhm.net> wrote:

On Apr 28, 2007, at 10:43 PM, Calvin Spealman wrote:
> Abstract
> ========
>
> The PEP defines the proposal to enhance the super builtin to work
> implicitly
> upon the class within which it is used and upon the instance the
> current
> function was called on. The premise of the new super usage
> suggested is as
> follows:
>
>     super.foo(1, 2)
>
> to replace the old:
>
>     super(Foo, self).foo(1, 2)
>
>
> Rationale
> =========
>
> The current usage of super requires an explicit passing of both the
> class and
> instance it must operate from, requiring a breaking of the DRY
> (Don't Repeat
> Yourself) rule. This hinders any change in class name, and is often
> considered
> a wart by many.

This is only a halfway fix to DRY, and it really only fixes the less
important half. The important problem with super is that it
encourages people to write incorrect code by requiring that you
explicitly specify an argument list.

Since calling super with any
arguments other than the exact same arguments you have received is
nearly always wrong,

  Erm.  Excuse me, but are you saying this code is wrong?

class Rectangle:
    def __init__(self, width, height):
        self.width = width
        self.height = height

class Square:
    def __init__(self, side):
        Rectangle.__init__(self, side, side)

Or are you even saying this type of code is rare?  I would disagree with both statements, therefore I also disagree with your recommendation.

--
Gustavo J. A. M. Carneiro
"The universe is always one step beyond logic." -- Frank Herbert