I'd like to ask about
sup = super(self, self)
Python Cookbook 3rd by David Beazley & Brian K. Jones has a number of such examples. This is the abbreviated excerpt of code of one from the book:
class MatchSignaturesMeta(type):
def __init__(self, clsname, bases, clsdict):
super().__init__(clsname, bases, clsdict)
sup = super(self, self)
for name, value in clsdict.items():
# ...
prev_dfn = getattr(sup, name, None)
# ...
class Root(metaclass=MatchSignaturesMeta):
pass
class A(Root):
def foo(self, x, y):
pass
# ...
through experiment I know that the second super argument is mandatory. sup is printed as:
<super: <class 'Root'>, <Root object>>
In the documentation super they say
"If the second argument is omitted, the super object returned is unbound."
"Bound/unbound method" (a function with its 1st parameter bound to the class instance) is familiar. What is the "bound object" ?
In the example the Root class is being created. I see no explicit Root object creation. I'd like to ask where did Root object (from the sup printable representation above) come from?
Using Python 3.5.3 on Debian GNU/Linux 9.11 (stretch)