[Python-3000] Thoughts on collections.Container and collections.Iterable
Nick Coghlan
ncoghlan at gmail.com
Sat Feb 9 14:08:07 CET 2008
Raymond Hettinger wrote:
> Besides, for the "gurus who are in the know", the min() and max()
> functions can often be substituted directly for any() and all()
> and then you get the key= syntax for free ;-)
>
> any(x%2==0 for x in s)
> max(x%2==0 for x in s)
Except that you lose the short-circuiting behaviour by using the latter
form.
Anyway, for some reason the whole 'these work really well with generator
expressions' aspect of any/all completely slipped my mind when I asked
that question about a key argument. Sorry for the pointless noise...
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list