[IPython-dev] Tab completion for composed objects

Thomas Kluyver takowl at gmail.com
Fri Dec 13 12:19:18 EST 2013


On 13 December 2013 05:42, Clyde <clyde.fare at gmail.com> wrote:

> Are there any plans to extend tab completion to classes that use
> composition
> rather than inheritance to extend a baseclass? (Or is it possible already
> with some suitable trick?)


Do you mean using something like __getattr__() to redirect attribute access
to another object? If so, the relevant trick is to override __dir__() to
list the attributes you want tab completion to see:
http://docs.python.org/3/reference/datamodel.html#object.__dir__

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20131213/35d2099f/attachment.html>


More information about the IPython-dev mailing list