Official Notes :
Super (type[, Object-or-type])
Return the superclass of type. If thesecond argument is omitted the Super object
Returned is unbound. If The second argument is an object,isinstance (obj, type)
Must be true. If The second argument is a type, Issubclass (type2, type) must be
True. Super () only works for New-style classes.
The subclass accesses the parent class with the same name and does not want to refer directly to the parent class's name.
>>> class A (object):
... def m (self):
... print (' A ')
...
>>> class B (A):
... def m (self):
... print (' B ')
... super (). m ()--python3.x above can be written like this. At least 3.5 is possible.
...
>>> B (). m ()
B
A
>>> class B (A):
... def m (self):
... print (' B ')
... super (B, self). m ()
...
>>> B (). m ()
B
A
understand the following:super (b, self) looks for the parent of B and converts self to the object of the parent class of B , and then executes the method with the same name.
This article is from the "90SirDB" blog, be sure to keep this source http://90sirdb.blog.51cto.com/8713279/1826187
Python Super ()