[Python-ideas] Break the dominance of boolean values in boolean context
Chris Rebert
pyideas at rebertia.com
Thu Sep 15 02:20:48 CEST 2011
On Wed, Sep 14, 2011 at 4:15 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Steven D'Aprano wrote:
>
>> I don't see that. next() returns the next item from an iterator regardless
>> of its boolean state. The actual and proposed implementations of any() skip
>> over false items.
>
> While such a function might be useful, I think it would be
> better provided as a new function called something like
> first(), rather than changing any().
Ruby calls it "detect":
http://www.ruby-doc.org/core/classes/Enumerable.html#M001485
Cheers,
Chris
More information about the Python-ideas
mailing list