Last active
July 26, 2016 18:37
-
-
Save baroquebobcat/bb6c43a54c8ff3b1f5c05d61fb4c88d3 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
class A(object): | |
def __getattr__(s,i): | |
raise Exception('wth') | |
def raises(self): | |
"aoeu".nonexistent | |
@property | |
def yep(self): | |
self.raises() | |
A().yep |
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 A(object): | |
def __getattr__(s,i): | |
raise Exception('wth') | |
class B(A): | |
@property | |
def b(self): | |
return "B's b" | |
class C(B): | |
@property | |
def b(self): | |
raise AttributeError('wut1') | |
getattr(C(), 'b') # -> wth | |
#I guess it calls __getattr__, but not super. That's good. |
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 A(object): | |
def __getattr__(s,i): | |
raise Exception('wth') | |
class B(A): | |
@property | |
def b(self): | |
raise AttributeError('wut') | |
class C(B): | |
@property | |
def b(self): | |
super(C, self).b | |
getattr(C(), 'b') # You might expect wut here, but you would be wrong. |
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 A(object): | |
def __getattr__(s,i): | |
raise Exception('wth') | |
class B(A): | |
@property | |
def b(self): | |
raise AttributeError('wut') | |
class C(B): | |
@property | |
def b(self): | |
raise AttributeError('wut1') | |
getattr(C(), 'b') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment