[issue18652] Add a “first” function to the stdlib
Nick Coghlan
report at bugs.python.org
Sun Aug 4 13:50:16 CEST 2013
Nick Coghlan added the comment:
Regarding the key parameter name, I believe this is closer to itertools.groupby (which uses "key=" as an optional argument, akin to min, max and sorted) than it is to filterfalse, dropwhile or takewhile (which use "pred" as the first positional argument)
The only use of "pred" in the optional key argument sense appears to be the "quantify" recipe.
+1 for itertools.coalesce, taking the name from SQL. It's designed to serve exactly the same purpose as COALESCE does there, doesn't risk confusion with next-like behaviour the way "first" does and hints strongly at the fact it is a reduction operation from an iterable to a single value.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18652>
_______________________________________
More information about the Python-bugs-list
mailing list