[IPython-User] Tab completion doesn't work on class/instance where __getattr__ has been overridden

Jeremy Conlin jlconlin@gmail....
Tue Mar 1 13:58:54 CST 2011

I have a class (subclassed from list) where I have overwridden the
__getattr__ method as:

    def __getattr__(self, name):
        if name.startswith("__"): raise AttributeError
        def _multiplexed(*args, **kwargs):
            return [getattr(R, name)(*args, **kwargs) for R in self]
        return _multiplexed

Now when I try to use tab completion, iPython just beeps at me and
doesn't complete anything.  If I remove this method from my class, I
can do tab completion.

Does the tab completion use __getattr__ somewhere?  Can I add
something to my definition to make tab completion work in iPython?


More information about the IPython-User mailing list