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

Walter Dörwald walter at livinglogic.de
Fri Jul 14 06:35:32 EDT 2006

Ville Vainio wrote:
> On 7/13/06, Walter Dörwald <walter at livinglogic.de> wrote:
>> That already works (if you're using ibrowse as the output, i.e. if you
>> have curses). For example try:
>>    ix("ls -l -R") | ifilter("_.endswith('.py')")
>> This starts output right away (once it finds the first Python file).
>> However if the command executed does some output it messes up the
>> screen. Maybe subprocess is the solution for that?
> Can't you just use normal os.popen4 to get both stdout and stderr (and
> thus avoid the risk of screwing the screen?)

I'll give this a try.

Another problem is when output is canceled while the external program is
still running. I'm using a pipe.close() in the __del__() method, but
that doesn't work reliably. I guess Python 2.5 would solve this problem
with try:finally: support in generators.

>> What I don't know anything about is how
>>   ls * | grep foo
>> would be turned into
>>   ix("ls *") | igrep("foo")
>> (or something similar that is a proper Python expression).
> 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?

> What should the input prefilter look for? Perhaps two |'s at the start
> of the line, e.g.
> || ls *.exe | igrep("foo")
> Would be translated to
> ix("ls *.exe")  | igrep("foo")

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`


More information about the IPython-dev mailing list