> > 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4