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):
>     __super = super(A)
>     def foo(self):
>         return self.__super.foo()
> 
> This allows you to rename A and only have to change one super call to
> reflect the new name.
> 

Except that doesn't work unless you use something like the autosuper
metaclass trick from test_descr.py (since the class A does not yet
exist where I put that super call).  And autosuper has a comment that
it "only works for dynamic classes" -- not sure that I understand what
"dynamic" means there.

In case you haven't guessed by now, I've only used two-arg super in my
own code.

---
Greg Chapman


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to