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 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 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 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 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