Created
August 14, 2014 10:00
-
-
Save ramnes/92e71e1b4dbcb4c0df3c to your computer and use it in GitHub Desktop.
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
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