Skip to content

Instantly share code, notes, and snippets.

@baroquebobcat
Last active July 26, 2016 18:37
Show Gist options
  • Save baroquebobcat/bb6c43a54c8ff3b1f5c05d61fb4c88d3 to your computer and use it in GitHub Desktop.
Save baroquebobcat/bb6c43a54c8ff3b1f5c05d61fb4c88d3 to your computer and use it in GitHub Desktop.
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