[IPython-dev] Ticket #127

Ville M. Vainio vivainio at gmail.com
Mon Mar 12 12:53:51 EDT 2007


On 3/11/07, Jörgen Stenarson <jorgen.stenarson at bostream.nu> wrote:

> I just attached a possible patch to ticket #127 (by the way #128 seems
> to be a copy of #127). It is not a completely finished I know there are
> some problems left but it fixes the most immediate problems.

Thanks, some notes:

> 1. With a single " at the beginning of the line it does not crash now.
> There are however still possible problems with \ and ' that are not
> properly handled.

I think the patch is a bit too elaborate and large. I would have
preferred to just catch the exception and raise ipapi.TryNext (i.e.
reverting to "behaviour as usual" if we are unable to be helpful
"easily") on failure. In the spirit of "worse is better" and "the
simplest thing that could possibly work".

> 2. The filematcher from ipython.completer has been copied and slightly
> changed to work on its own and not as a method.
>
> 3. Both cd and run now uses this extracted filematcher and should have
> more of a standard behaviour.
>
> For the future I think it would be nice to do a refactoring of the
> completer functionality. For instance use the exact same code for file
> matching in the standard completer as in the handlers. It would probably
> also be good to have a standard function to decompose a line for the
> handlers to avoid future problems with "'\ handling. As well as adding
> some tests for this functionality.

Now if you could find the time to do that, it would be great! Some
kind of completerutil.py to which we could use to clean up
ipy_stock_completers.py (which is becoming a bit large).

BTW, I don't really like the way you don't replace \ with / in your
patch. Is there a problem with getting /'s, i.e. did you hit some bugs
because of them?

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'



More information about the IPython-dev mailing list