short-circuiting any/all ?
kj
no.email at please.post
Mon Mar 22 18:19:57 EDT 2010
In <mailman.1069.1269283393.23598.python-list at python.org> Tim Golden <mail at timgolden.me.uk> writes:
>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)
I was talking in the *general* case. map at the very least requires
a lambda expression, which is a one-time function defintion.
~K
More information about the Python-list
mailing list