short-circuiting any/all ?

Tim Golden mail at timgolden.me.uk
Mon Mar 22 14:43:07 EDT 2010


On 22/03/2010 18:30, kj wrote:
> Thanks!  I'm glad to know that one can get the short circuiting
> using a map-type idiom.  (I prefer map over comprehensions when I
> don't need to define a function just for the purpose of passing it
> to it.)

In what way does "map" over "comprehensions" save you defining a function?

any (map (is_invalid, L))
any (is_invalid (i) for i in L)

TJG




More information about the Python-list mailing list