Last active
December 18, 2015 03:19
-
-
Save rcoup/5717772 to your computer and use it in GitHub Desktop.
__getattr__ plus @Property is NOT INTUITIVE
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
class Test(object): | |
@property | |
def x(self): | |
print "property-x" | |
return 7 | |
def y(self): | |
return 8 | |
a = 9 | |
def __getattr__(self, name): | |
print "getattr:", name | |
#if isinstance(getattr(self.__class__, name, None), property): | |
# return super(Test, self).__getattr__(name) | |
return 1 |
Author
rcoup
commented
Jun 5, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment