Hynek Schlawack added the comment: > def coalesce(iterable, default=None, pred=None): > return next(filter(pred, iterable), default) > > Are you sure you want add this one-line function to the itertools module > rather then to recipes?
Well, for many – including me – it would mean to have this one-line function in every other project or a PyPI dependency. I’m certain there are other short but useful functions in the stdlib. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18652> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com