[IPython-User] Advice on using a prefilter

Thomas Kluyver takowl@gmail....
Tue Aug 7 06:14:31 CDT 2012


On 7 August 2012 05:47, Aaron Meurer <asmeurer@gmail.com> wrote:
>> Yes, that would be due to this bit of code:
>> https://github.com/ipython/ipython/blob/master/IPython/core/interactiveshell.py#L2593
>
> So can this if statement be removed?

Not trivially. The difficulty is that the context from previous lines
might affect whether something should be transformed - e.g. we mustn't
transform a line that's inside a string. And we need to be careful
about things like this:

In [1]: 5 \
   ...: % 2
Out[1]: 1

Again, apologies that this API hasn't been better maintained.

Best wishes,
Thomas


More information about the IPython-User mailing list