Skip to content

Instantly share code, notes, and snippets.

@ramnes
Created August 14, 2014 10:00
Show Gist options
  • Save ramnes/92e71e1b4dbcb4c0df3c to your computer and use it in GitHub Desktop.
Save ramnes/92e71e1b4dbcb4c0df3c to your computer and use it in GitHub Desktop.
def random_elsewhere_function():
raise AttributeError("oops")
class Foo(object):
@property
def bar(self):
random_elsewhere_function()
return "bar"
def __getattr__(self, attr):
error = "{!r} object has no attribute {!r}"
raise AttributeError(error.format(self.__class__.__name__, attr))
f = Foo()
f.bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment