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

Nick Coghlan ncoghlan at gmail.com
Wed Sep 14 05:38:39 CEST 2011

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.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list