Created
January 11, 2018 13:13
-
-
Save takluyver/6b9348f69ee88ee5d8439bc8ff816819 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
class CompleteAttrs(object): | |
def __getattr__(self, name): | |
if name == 'foo': | |
return 1 | |
if name == 'bar': | |
return 2 | |
raise AttributeError(name) | |
def __dir__(self): | |
return ['foo', 'bar'] + object.__dir__(self) | |
ca = CompleteAttrs() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment