18 Feb
2014
18 Feb
'14
11:30 p.m.
Sorry! I was Googling it, but I must have missed that bug report.
On Tue, Feb 18, 2014 at 4:42 PM, Tim Peters
[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.
-- Ryan If anybody ever asks me why I prefer C++ to C, my answer will be simple: "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated."