E.g. in python, you can't really 'pipe' to compose its filter and map built-ins, you have to do:
map(lambda x: x * 2,
filter(lambda x: x % 2 != 0, [1, 2, 3]))
(Or use list comprehensions which also are not pipe-like).He's also specifically talking about 'collections' as in 'lists of dicts' in Python parlance, or 'arrays of objects' in other languages.
The idea that you pass this 'collection' through a 'pipe' of operations is pretty powerful and obviously maps naturally to query-like behaviour. So to give Python back some dues, the place where you do of course see some 'collection piping' is when using the Django ORM.
So yeah it may sound a bit grandiose but I think he's highlighting those terms on purpose because it is about more than just map, filter and reduce.
mcoll - Modern API for python collections: https://github.com/nvbn/mcoll
I'd only previously come across underscore.py [0] (python port of underscore.js) which looked a little unmaintained though perhaps because it's 'done'.
def filter_authors(authors, company):
return [author['twitter_handle'] for author in authors if author['company'] == company and author['twitter_handle']]
EDIT: HN code formatting seems to be broken so you may need to scroll right to see the entire comprehension.You can do other SQL-like operations with list comprehensions too.
http://code.activestate.com/recipes/159974-sql-like-set-oper...