[IPython-dev] ESC_QUOTE in InteractiveShell

Fernando.Perez at colorado.edu Fernando.Perez at colorado.edu
Fri Feb 18 02:50:04 EST 2005


Quoting Titus Brown <titus at caltech.edu>:

> Hi all,
>
> I'm playing around with the implementation of a small scripting language
> in IPython, and it turns out one of the bits of behavior I need is
> auto-quoting.  (More on the *purpose* of all of this at a later date...)
>
> If you look at iplib.py, line 1556, you'll see:
>
> 	if pre == self.ESC_QUOTE: ...
>
> This is the 'if' statement that I need to have always be true for my
> purposes.  If I can make a clean patch to add this as a configuration
> option ('autoquote' or some such) or at least provide an API handle
> to set this option, would there be any objections?

No, there's no need to patch anything at all.  Please have a look at how pysh is
implemented, it's just a profile, which loads an extra line prefilter hook. 
Also study the tutorial or physics profiles, they do similar processing of the
input line.  You can simply put in your own prefilter hook which
unconditionally appends this character into the user input line, to guarantee
that the above statements always evaluates to true.

Note, however, that I screwed up in 0.6.11 and autoquoting is actually broken. 
Now, I suspect very few people use this feature, but Murphy's law being what it
is, the first time I break the feature in 3 years has to be precisely the only
time a user actually talks about it. Oh well...

The bug is already fixed in CVS, so you may want to use that instead.

Regards,

f




More information about the IPython-dev mailing list