Nick Coghlan added the comment:
I concede Tim's point about itertools already using underscores where it
improves readability of a name :)
So, the latest state of the proposal is to add the following, preferably
directly to the module, but at least as a recipe in the itertools docs:
def first_true(iterable, default=None, pred=None):
"""Returns the first true item in the iterable
If no such item is found, returns *default*
If *pred* is not None, returns the first item
for which pred(item) is true.
"""
return next(filter(pred, iterable), default)
----------
title: Add itertools.coalesce -> Add itertools.first_true (return first true
item in iterable)
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18652>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com