[IPython-dev] A possible bug.
Fernando Perez
Fernando.Perez at colorado.edu
Mon Sep 27 21:24:00 EDT 2004
Fernando Perez schrieb:
> Andrea Riciputi wrote:
>
>>Hi,
>>I've found what I think is a bug. If I try to hit tab to complete a
>>module object or attribute I get the following traceback. HTH to fix
>>this problem.
>
>
> I suppressed the nasty output in 0.6.3, but readline still doesn't properly if
> you try:
>
> [modulename.foo<TAB>
>
> However, doing:
>
> [ modulename.foo<TAB>
> ^^^ -> Note the space
>
> works. It has to do with how readline splits the line in pieces for
> evaluation purposes. I'll see if I can make readline complete that kind of
> syntax, but no promises. At least current ipython simply doesn't complete in
> that case, instead of spitting out that scary-looking traceback.
Ok, I did a bit of work on this one, and here's what I found. You can get
ipython to complete [modname.<TAB> expressions, simply by setting in your
ipythonrc file:
readline_remove_delims '"-/~
The current default value is:
readline_remove_delims '"[]{}-/~
Here's what happens: if you HAVE []{} in remove_delims, then you can do:
In [1]: [].<TAB HERE>
[].append [].extend [].insert [].remove [].sort
[].count [].index [].pop [].reverse
However, it breaks the completion for [modname.<TAB>, since now '[' is
considered part of the expression to be completed.
In retrospect, I think it's better to _allow_ [modname.<TAB> to work
correctly, at the expense of killing [].<TAB>, since a list comprehension is
more common than typing TAB on the naked [] list constructor. The argument
may not be as strong for {}, since dict comprehensions don't exist, but I may
change the default for both just to keep the interface uniform.
Unless I hear anyone complain, I'll then update things so that the new default
will be:
readline_remove_delims '"-/~
Cheers,
f
More information about the IPython-dev
mailing list