On Wed, Jun 1, 2011 at 7:03 AM, Billy Mays <no...@nohow.com> wrote: > I read this when it was on HN the other day, but I still don't see what is > special about super(). It seems (from your post) to just be a stand in for > the super class name? Is there something special I missed?
It's not a stand-in for the super-class name. It's a stand-in for whatever class is next in the Method Resolution Order (MRO), which is determined at run-time and can vary depending on what the actual class of the object is. For example, in this inheritance situation: class A(object): ... class B(object): ... class C(A, B): ... a = A() c = C() The MRO of A is (A, object). The MRO of B is (B, object). The MRO of C is (C, A, B, object). Thus, super(A, a) is going to resolve to object, as you might expect. But super(A, c) is going to resolve to B, because the next class after A in the MRO for C instances is B. That's a pretty quick and dirty explanation. If it doesn't make sense, I suggest reading the article again. -- http://mail.python.org/mailman/listinfo/python-list