AttrDict
AttrDict copied to clipboard
Override __dir__ to allow for tab completion in ipython and easier inspection
The common thing to do if you override __getattr__
is to also override __dir__
like so:
def __dir__(self):
# you may also want to filter the keys to only include the strings
return sorted(set(super(AttrDict, self).__dir__()) + set(self.keys()))
This would make it much easier to use attrdict in IPython and other IDEs as you would gain auto-completion.
Is this repository abandoned?
@aldanor Perhaps the @bcj will include this more quickly if you submit a pull request?
+1