[IPython-user] Custom command completers implemented in SVN

Fernando Perez fperez.net at gmail.com
Wed Nov 1 12:15:45 CST 2006


On 11/1/06, Stefan van der Walt <stefan at sun.ac.za> wrote:

> As far as I remember, that used to work a number of revisions ago.
> Now, the completion after the quote isn't being done properly.  For
> example, if I type fun('/home<tab><tab> I see
>
> In [1]: fun('/home/'
> Display all 192 possibilities? (y or n)
>
> but if I type fun('/home/<tab>
>
> In [1]: fun('/home/stefan/'
>
> Maybe someone else on a linux machine can try this example and report
> on what they see -- could be that my setup that is broken.

Stefan, I think you are mistaken, at least since quite a while.
Reverting back to 0.7.1:

IPython 0.7.1.fix1 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: fun('/home/'
Display all 204 possibilities? (y or n)

In [1]: fun('/home/fperez/'
Display all 204 possibilities? (y or n)

In [1]: fun('/home/fperez/'


Basically, ever since the code has had the ability to close the quote
mark on an unambiguous completion, it has worked this way.  This could
be improved, but it would be /new/ functionality, not fixing a
regression.  The analysis to do is to check whether the end of the
completion is a filename or a non-empty directory.  If it's a
filename, we can just close the quotes since nothing else can go after
that, but if it's a non-empty directory, it's better to not close
them.

The implementation is easy.  I'm busy right now, but I might do it
tonight if you want it.

Cheers,

f


More information about the IPython-user mailing list