Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class A(object):
def __getattr__(s,i):
raise Exception('wth')
def raises(self):
"aoeu".nonexistent
@property
def yep(self):
self.raises()
A().yep
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.
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.
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
You can’t perform that action at this time.