Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Ned Batchelder <ned-Yjx/1JTc0sIU3jUH6EPctAC/G2K4zDHf <at> public.gmane.org>
Subject: Re: Break the dominance of boolean values in boolean context
Newsgroups: gmane.comp.python.ideas
Date: Wednesday 14th September 2011 00:59:07 UTC (over 5 years ago)
On 9/12/2011 4:20 PM, Lukas Lueg wrote:
> Summing all up, I really think that we should break the dominance of 
> bool() and take a look at how we can implement boolean contexts 
> without relying on boolean values all the time. 
I was surprised to find that any() returns True or False, regardless of 
the values it encounters.  Conceptually, these two are the same (where S 
is a sequence S0, S1, S2, ..., Sn):

     any(S)

     S0 or S1 or S2 or ... or Sn

They are equivalent except that if Sx is the first true-ish value, the 
first will return True while the second returns Sx.  Why shouldn't any() 
also return Sx?

--Ned.
 
CD: 2ms