Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
You can’t perform that action at this time.