[IPython-dev] Ticket #127

Jörgen Stenarson jorgen.stenarson at bostream.nu
Thu Mar 15 15:39:08 EDT 2007


Here is the reworked patch. It only tries to fix the " problem for %run.


/Jörgen

Ville M. Vainio skrev:
> 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?
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/applefile
Size: 1499 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20070315/3b04f5cb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipy_stock_completers_2.diff
Type: application/octet-stream
Size: 1372 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20070315/3b04f5cb/attachment.obj>


More information about the IPython-dev mailing list