Created
June 12, 2017 19:20
-
-
Save erochest/c88a60da86264b4977e16f7c5290c1f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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