[Python-ideas] Break the dominance of boolean values in boolean context

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Sep 15 05:41:35 CEST 2011

On 15/09/11 11:25, MRAB wrote:

> Could it also have something like a 'key' argument, by default
> __bool__?

Or more generally, a function.

Although that's not strictly necessary. If there were a first()
function that simply returned the first item from an iterator,
whether true or not, one could write

   first(itertools.ifilter(func, something))


More information about the Python-ideas mailing list