Ned Batchelder | 14 Sep 02:59 2011

Re: Break the dominance of boolean values in boolean context

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.

Gmane