18 Feb
2014
18 Feb
'14
10:42 p.m.
[Ryan Gonzalez
It isn't uncommon to try and get either the first or the last True value from a list. In Python 2, you'd do this:
next((x for x in mylist if x))
And, in Python 3, thanks to filter returning an iterator, you'd do this:
next(filter(bool,mylist)) ...
See here: http://bugs.python.org/issue18652 Never heard anyone ask for "last" before "first" has been available in a PyPI package for over a year. Detail in the bug report.