[IPython-dev] Fwd: [Matplotlib-users] Improved dashing for black and white plots?

Walter Dörwald walter at livinglogic.de
Fri Jul 14 12:33:00 EDT 2006


Ville Vainio wrote:

> On 7/14/06, Walter Dörwald <walter at livinglogic.de> wrote:
> 
>> > It shouldn't, normally. We could have an input prefilter for turning
>> > the first part of the pipeline to ix(cmd) but the rest of the pipeline
>> > should be explicit ipipe function invocations (i.e. normal python).
>>
>> How is ! handled?
> 
> It gets turned into _ip.system(cmd) python statement, which of course
> executes the whole line in cell. See Extensions/ext_rescapture.py on
> how to add a new input_prefilter hook.

Thanks for the hint. It would be simple enough to add a handler for
"`(?P<cmd>.*)`". I think I'll play around with this over the weekend.

>> It would be great if shell expressions could be used in the middle of a
>> pipeline. Maybe we should use backticks for that?
>>
>> (random.randint(0, 255) for i in xrange(256)) | isort | `uniq`
> 
> It would obviously be great in pipeline expressions (started with ||,
> i.e. something starting with a system command execution) but less
> obvious in arbitrary command lines like the one in your example (how
> do we recognize that this is a pipeline and therefore backticks need
> to be handled as system commands? )

I would have suggested simply taking over the backticks, i.e. something
with backticks *always* gets replaced. But this might be too radical, so
we need other delimiters that are unused in normal Python code.

> Perhaps we should have a prefilter that considers "series of elements
> separated by | where at least one is in backticks and that don't start
> with a valid system command" as a pipeline where backticks get turned
> to ix()?

If all backticks would get turned into ix() it would automatically be a
pipeline expression (as it contains an ipipe table).

> It would make
> 
> `cat hi.txt` | isort
> 
> work but
> 
> cat hi.txt | isort
> 
> would fail (because cat is a system command and passed through normal
> _ip.system() mechanism, which should still be the case).

Servus,
   Walter



More information about the IPython-dev mailing list