-
-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc error on super(cls,self) #40406
Comments
In both the Library Reference, section 2.1, and in the super( type[, object-or-type])
Returns the superclass of type. ... This is misleading. I could not get this function to work I think a better explanation would be: super(cls,self).m(arg) Calls method 'm' from a class in the MRO (Method The 'super' built-in function actually returns not a class, |
Logged In: YES Would an expanded example also help? I'm not sure I like my own wording yet, but ... I propose it as a """super returns the next parent class[1] class A(object): pass
class B(A):
def meth(self, arg):
super(B, self).meth(arg)
class C(A): pass
class D(B, C): pass
d=D()
d.meth() In this case, the super(B, self) call will actually return a [1] Actually, a super class mimicing the parent class. """ |
Logged In: YES I like the example, but the new explanation still leaves the The only thing lacking in the example is motivation for why we |
Logged In: YES While waiting for the perfect solution, would it be possible to |
Logged In: YES bpo-1163367 suggests a more complete new wording. Closing as |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: