* Chow Loong Jin <hyperair@debian.org>, 2013-06-09, 18:19:
* URL : https://pypi.python.org/pypi/first
[...]
An example would be helpful, I think. I don't think it's immediately obvious to most people.I haven't looked at the code but you can do this in one line with itertools and a combination of keepwhile and dropwhile.A MIT licensed Python package with a simple function that returns the first true value from an iterable, or None if there is none. If you need more power, you can also supply a key function that is used to judge the truth value of the element or a default value if None doesn’t fit your use case.Is that a dependency for something else? The software contains 10 lines that can be considered code.
Upstream documents a few one-liner alternatives: https://pypi.python.org/pypi/first#AlternativesThe point of this package is not to make things shorter, but more readable. </devil's-advocate>
-- Jakub Wilk