[Python-Dev] pipe syntax for sequential data

Josiah Carlson jcarlson at uci.edu
Tue Apr 13 12:10:41 EDT 2004


> > This recipe proposes an alternative syntax for sequential data
> > processing functions, that reflects unix shell pipe syntax. Here is an
> > example:
> >
> > bash_users = ( file('/etc/passwd') | grep('/bin/bash') | aslist )
> >
> > I don't know if this idea was already explored before; hope this can
> > be useful. For details and sample code please see link above.
> 
> If you're serious about this, you'll need to write up a PEP and push it
> forward.


While some would call Python a 'scripting language', I think that using
pipes in such a way in Python would be counter to the zen:
"There should be one-- and preferably only one --obvious way to do it."

We can already use list comprehensions, filter and friends (or ifilter as used by
MK), when such functionality is desired.  IMO, just because you can make
a language  behave like a command line, does not necessarily mean that
you should.

 - Josiah




More information about the Python-Dev mailing list