any() and all() Was: Pre-PEP: Dictionary accumulator methods

Roose b at b.b
Sat Mar 19 18:48:51 CET 2005


Ah OK, I stand corrected.  Whoops.  I just read the web page and thought the
wrong thing, that makes sense.

> Think about it.  A key= function is quite a different thing.  It provides
a
> *temporary* comparison key while retaining the original value.  IOW, your
> re-write is incorrect:
>
> >>> L = ['the', 'quick', 'brownish', 'toad']
> >>> max(L, key=len)
> 'brownish'
> >>> max(len(x) for x in L)
> 8
>
>
> Remain calm.  Keep the faith.  Guido's design works fine.
>
> No important use cases were left unserved by any() and all().
>
>
>
> Raymond Hettinger
>
>





More information about the Python-list mailing list