6

Possible Duplicate:
Usage of Python 3 super()

In the documentation for Python 3.2 it says;

If the second argument is omitted, the super object returned is unbound

In my understanding, unbound (as in 'unbound-to-instance') object is what's returned from super(class, class). So, what's meant by 'unbound' in super(class)? How do you bind it?

class Base:
    def printme(self): print("I'm base")

class Derived(Base):
    def printme(self): print("I'm derived")

class Derived2(Derived):
    def printme(self):
        super().printme()
# next-in-mro bound-to-self method

        super(Derived, self).printme()
# beyond-Derived-in-mro bound-to-self method

        super(Derived, Derived2).printme(self)
# beyond-Derived-in-mro-of-Derived2 unbound method

        super(Derived2).printme
# WTF is this? There's not even a printme attribute in it

Derived2().printme()
Community
  • 1
  • 1
panda-34
  • 4,089
  • 20
  • 25
  • @Dave Webb Yep, right. I actually found the article that answer mentions before asking, but only the first part and this is explained in part 2. Shall I delete the question? – panda-34 Jul 02 '12 at 10:09

0 Answers0