Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Override __dir__ to allow for tab completion in ipython and easier inspection #37

Open
aldanor opened this issue Aug 31, 2015 · 3 comments

Comments

@aldanor
Copy link

aldanor commented Aug 31, 2015

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.

@aldanor
Copy link
Author

aldanor commented Nov 9, 2015

Is this repository abandoned?

@erikcw
Copy link

erikcw commented Dec 23, 2015

@aldanor Perhaps the @bcj will include this more quickly if you submit a pull request?

@nowox
Copy link

nowox commented Nov 10, 2016

+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants