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

Jacob Holm jh at improva.dk
Wed Sep 14 10:30:26 CEST 2011

On 2011-09-14 05:38, Nick Coghlan wrote:
> On Wed, Sep 14, 2011 at 12:39 PM, MRAB <python at mrabarnett.plus.com> wrote:
>> If none are true-ish, should it return the final (false-ish) value?
> By analogy with 'or', yes. (and ditto for 'all' vs 'and')
>> What should any([]) return?
> That's the more valid rationale - any()/all() need to work with an
> empty iterable, so the most obvious solution is to limit the range to
> True/False rather than having the result be data dependent.

The alternative would be to include a "start" parameter similar to
sum().  It would default to False for any(), and True for all().

- Jacob

More information about the Python-ideas mailing list