The only argument to super () is what is it for?

Possible duplicate:
Using Python 3 super ()

The documentation for Python 3.2 says:

If the second argument is omitted, the returning object is returned unbound

In my understanding, unbound (as in the "unbound-to-instance" object) is what came back from super (class, class). So what did "unbound" mean in super (class)? How do you connect it?

class Base: def printme(self): print("I'm base") class Derived(Base): def printme(self): print("I'm derived") class Derived2(Derived): def printme(self): super().printme() # next-in-mro bound-to-self method super(Derived, self).printme() # beyond-Derived-in-mro bound-to-self method super(Derived, Derived2).printme(self) # beyond-Derived-in-mro-of-Derived2 unbound method super(Derived2).printme # WTF is this? There not even a printme attribute in it Derived2().printme() 
+6
source share

Source: https://habr.com/ru/post/919486/


All Articles