Skip to content

Instantly share code, notes, and snippets.

@erochest
Created June 12, 2017 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erochest/c88a60da86264b4977e16f7c5290c1f0 to your computer and use it in GitHub Desktop.
Save erochest/c88a60da86264b4977e16f7c5290c1f0 to your computer and use it in GitHub Desktop.
#!/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