Created
May 31, 2020 10:56
-
-
Save eclecticmiraclecat/898531d9003bd8f2173c00b5bdebdf89 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Foo: | |
... def __getattr__(self, name): | |
... setattr(self, name, 'N/A') | |
... return getattr(self, name) | |
... | |
>>> f = Foo() | |
>>> f.x | |
'N/A' | |
>>> f.__dict__ | |
{'x': 'N/A'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment