[IPython-dev] History

Fernando Perez fperez.net at gmail.com
Fri Feb 18 11:06:26 EST 2011


Hi Tomas,

On Thu, Feb 17, 2011 at 1:46 PM, Thomas Kluyver <takowl at gmail.com> wrote:
> Good point, I hadn't thought of temporary aliases (I've never used them);
> and good solution. While we're on the subject, what does translation
> actually do? %magic commands, !system commands, aliases; anything else?

Our input processing has been fairly cleaned up, but it could still
use some more refactoring to put it all in one place so it's easier to
understand.  There are two parts to it: a) 'static' transformations
that can be applied to any input string without knowing about the
user's state/namespace.  b) dynamic ones that are only applied to
single-line input, and that are context-dependent.

The code that does the input processing of type (a) is here:

https://github.com/ipython/ipython/blob/master/IPython/core/inputsplitter.py

And the single-line prefiltering of type (b) is here:

https://github.com/ipython/ipython/blob/master/IPython/core/prefilter.py

(b) is only called in one place, by the run_single_line method:

https://github.com/ipython/ipython/blob/master/IPython/core/interactiveshell.py#L2188

I hope this helps, keep asking  and we'll try to explain things out...

Cheers,

f



More information about the IPython-dev mailing list