super with only one argument

Greg Chapman glc at well.com
Thu Mar 17 09:36:27 EST 2005


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.

---
Greg Chapman



More information about the Python-list mailing list