``super`` with only one argument ("bound" super) is a mess.
AFAICT ``super(C)`` is intended to be used as an attribute in
other classes. Then the descriptor magic will automatically convert the
unbound syntax in the bound syntax. For instance:
>>> class B(object):
...
Greg Chapman wrote:
> Steven Bethard wrote:
>
> > When would you call super with only one argument? The only examples
> > I can find of doing this are in the test suite for super.
> >
>
> I think it's to allow something like this:
>
> class A(B, C
Steven Bethard wrote:
> When would you call super with only one argument? The only examples
> I can find of doing this are in the test suite for super.
>
I think it's to allow something like this:
class A(B, C):
__super = super(A)
def foo(self):
return self.__sup
super(D, D).f()
D.f()
Just using super(D).f() would not work. ``super`` with only one
argument is
a recipe for headaches.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
"Michele Simionato" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I asked myself the same question and I am not convinced
that using 'super' with one argument really makes sense
(i.e. IMO it is more a liability than an asset). BTW, I have a set
of notes on the tricky aspects of 'supe
I asked myself the same question and I am not convinced
that using 'super' with one argument really makes sense
(i.e. IMO it is more a liability than an asset). BTW, I have a set
of notes on the tricky aspects of 'super' you may be interested in.
Michele Simionato
--
http://mail.pyth
When would you call super with only one argument? The only examples I
can find of doing this are in the test suite for super. Playing around
with it:
py> class A(object):
... x = 'a'
...
py> class B(A):
... x = 'b'
...
py> s = super(B)
py> s.x
Traceback