Skip to content

Instantly share code, notes, and snippets.

@erochest
Created Jun 12, 2017
Embed
What would you like to do?
#!/usr/bin/env python3
class A:
def __phone_home(self):
print('A.__phone_home')
def phone_home(self):
print('From A')
self.__phone_home()
class B(A):
def __fly_home(self):
print('B.__fly_home')
def fly_home(self):
print('From B')
self.__fly_home()
def phone_home(self):
print('From B')
super(B, self).phone_home()
a = A()
b = B()
a.phone_home()
b.phone_home()
b.fly_home()
print('A:', dir(A))
print('B:', dir(B))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment