Re: [Ipython-svndiff] 2609 - prefilter: make sure that ! gets precedence

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [Ipython-svndiff] 2609 - prefilter: make sure that ! gets precedence

Fernando Perez
On 8/13/07, [hidden email] <[hidden email]> wrote:

> Author: vivainio
> Date: 2007-08-13 12:39:08 -0500 (Mon, 13 Aug 2007)
> New Revision: 2609
>
> Modified:
>    ipython/trunk/IPython/prefilter.py
> Log:
> prefilter: make sure that ! gets precedence
>
> Modified: ipython/trunk/IPython/prefilter.py
> ===================================================================
> --- ipython/trunk/IPython/prefilter.py  2007-08-13 17:37:41 UTC (rev 2608)
> +++ ipython/trunk/IPython/prefilter.py  2007-08-13 17:39:08 UTC (rev 2609)
> @@ -48,6 +48,11 @@
>          self.pre, self.iFun, self.theRest = splitUserInput(line)
>
>          self.preChar       = self.pre.strip()
> +
> +        # special override for !, which MUST always have top priority
> +        if not self.preChar and self.iFun.startswith('!'):
> +            self.preChar = self.pre = '!'

Please don't hardcode the special escapes, that's why we have a table
of constants:

        # escapes for automatic behavior on the command line
        self.ESC_SHELL  = '!'
        self.ESC_SH_CAP = '!!'
        self.ESC_HELP   = '?'
        self.ESC_MAGIC  = '%'
        self.ESC_QUOTE  = ','
        self.ESC_QUOTE2 = ';'
        self.ESC_PAREN  = '/'

If anyone ever writes a customized shell and modifies this, hardcoded
symbols deep inside are going to make a mess.

f
_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev