Skip to content

Instantly share code, notes, and snippets.

@piotr-dobrogost
Created September 29, 2015 11:48
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 piotr-dobrogost/97cca8b039319e247451 to your computer and use it in GitHub Desktop.
Save piotr-dobrogost/97cca8b039319e247451 to your computer and use it in GitHub Desktop.
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
/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