Joshua Landau wrote: > On 11 June 2013 01:11, Peter Otten <__pete...@web.de> wrote: >> def partition(items, predicate=bool): >> a, b = itertools.tee((predicate(item), item) for item in items) >> return ((item for pred, item in a if not pred), >> (item for pred, item in b if pred)) > > I have to tell you this is the coolest thing I've read today. I'd > never have thought of that.
:) -- http://mail.python.org/mailman/listinfo/python-list