[IPython-dev] IPython bug?

Gary Bishop gb at cs.unc.edu
Sat May 24 15:33:59 CDT 2003


On Sat, 24 May 2003 14:20:37 -0600 "Fernando Perez" 
<fperez at colorado.edu> wrote:

Yes, your text cases convince me.

> I can get this to work with:

> [IPython]> diff -Naur iplib_ori.py iplib.py
> --- iplib_ori.py        2003-05-24 13:10:58.000000000 -0600
> +++ iplib.py    2003-05-24 14:09:11.000000000 -0600
> @@ -1078,11 +1078,8 @@
>               parameter_s = ''
>               scommand = line
>           if hasattr(self, scommand):
> -            if parameter_s.startswith('"'):
> -                parameter_s = ' ' + parameter_s
> -            if parameter_s.endswith('"'):
> -                parameter_s += ' '
> -            return shell+scommand+'(parameter_s="""%s""")' % (parameter_s,)
> +            parameter_s = " %s " % parameter_s # Protect quotes at the end
> +            return shell+scommand+'(parameter_s=r"""%s""")' % parameter_s
>           else:
>               return shell+line+'()'


> It's basically the same patch as before, with an added raw string 
> literal for the string as passed.

Yes! This seems to work fine. It is hard for me to think about the 
possibilities with an extra level of interpretation going on. Like 
working on a macro processor.

>> Maybe we should avoid \ as much as possible.

>> Getting the quotes right probably requires character by character 
>> processing of the line.

>> What do you think?

> That down this path lies insanity :)

Agreed. Your raw string change appear to fix it and leaves open all the 
possibilities. Good deal.

gb



More information about the IPython-dev mailing list