On Tue, Apr 05, 2022 at 09:55:00PM +1200, Greg Ewing wrote:

> I would also say that if you're passing super anything *other*
> than the class where the method is defined, you're trying to
> be too clever by half, and will get bitten.

+1

In Python 3, you should (nearly?) always just call the zero-argument 
form of super from inside methods. I think that the only time you need 
to specify the arguments yourself is when you are writing a method 
outside of the class, and injecting into an existing class:

```
class Spam(Food):
    pass

# outside the class, later on.

def method(self, arg):
    a = super().method(arg)  # won't work
    a = super(Spam, self).method(arg)  # but this will    
    return a

Spam.method = method

```

I can't think of any other good reasons for manually providing the 
arguments to super, but that doesn't mean they don't exist.


-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/XUNRV6KZUTKU4ZAPGDM4AD5SNQEELDXK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to