[Python-ideas] Adding an optional function argument to all() and any() builtins

Tim Lesher tlesher at gmail.com
Mon Nov 22 12:32:41 CET 2010

On Sun, Nov 21, 2010 at 23:29, Steven D'Aprano <steve at pearwood.info> wrote:
> I'm (mildly) with Bruce on this one, but I think we missed the boat. Perhaps
> in Python4000 any() and all() should return the relevant object rather than
> True/False.

That could be the source of some frightening, hard-to-detect regressions:

if any([-1,0,1], test=is_even):
    # never taken, because 0 is returned instead of True

Tim Lesher <tlesher at gmail.com>

More information about the Python-ideas mailing list