Created
September 29, 2015 11:48
-
-
Save piotr-dobrogost/97cca8b039319e247451 to your computer and use it in GitHub Desktop.
This file contains 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
class Base(object): | |
pass | |
class C(Base): | |
an_attr = None | |
def __init__(self): | |
self.an_attr = 1 | |
def __getattribute__(self, key): | |
return super(C, self).__getattribute__(key) | |
c = C() | |
print c.an_attr |
This file contains 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
/home/piotr/projects/sandbox/python/venv/bin/python /home/piotr/projects/sandbox/python/getattribute.py | |
1 | |
Process finished with exit code 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment