# superstuff.py # Lillian Lee (LJL2) # May 2017 """Demonstrate the use of super with deeply nested classes""" class A(object): def yelp(self): return "A" class B(A): def yelp(self): return "B" class C(B ): def yelp(self): return "C" class D(C): pass if __name__ == '__main__': the_fox = D() print super(D,the_fox).yelp() # --> C.yelp(the_fox) print super(C,the_fox).yelp() # --> B.yelp(the_fox) print the_fox.yelp(), D.yelp(the_fox) # these are equivalent