kj wrote:
Arguably, Knuth's "premature optimization is the root of all evil"
applies even to readability (e.g. "what's the point of making code
optimally readable if one is going to change it completely next
day?")
The guy who will change it will have to read it. The only waste would be
if the
In Steven D'Aprano
writes:
>On Mon, 22 Mar 2010 22:19:57 +, kj wrote:
>In any case, the once-off cost of creating or importing a function is
>usually quite cheap. As usual, the best advise is not to worry about
>optimization until you have profiled the code and learned where the
>actual
On Mon, 22 Mar 2010 22:19:57 +, kj wrote:
> In Tim Golden
> 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 p
In Tim Golden
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"
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 defin
In <291d82b7-b13b-4f49-901c-8194f3e07...@e7g2000yqf.googlegroups.com> nn
writes:
>If you are in Python 3 "any(map(is_invalid, L))" should short circuit.
>If you are in Python 2 use "from itertools import imap;
>any(imap(is_invalid, L))"
Thanks! I'm glad to know that one can get the short circu
On Mar 22, 7:45 am, kj wrote:
> I have a list of items L, and a test function is_invalid that checks
> the validity of each item. To check that there are no invalid
> items in L, I could check the value of any(map(is_invalid, L)).
> But this approach is suboptimal in the sense that, no matter wha
kj wrote:
> I have a list of items L, and a test function is_invalid that checks
> the validity of each item. To check that there are no invalid
> items in L, I could check the value of any(map(is_invalid, L)).
> But this approach is suboptimal in the sense that, no matter what
> L is, is_invali
On Mon, 2010-03-22 at 14:45 +, kj wrote:
> I have a list of items L, and a test function is_invalid that checks
> the validity of each item. To check that there are no invalid
> items in L, I could check the value of any(map(is_invalid, L)).
> But this approach is suboptimal in the sense that,
kj wrote:
I have a list of items L, and a test function is_invalid that checks
the validity of each item. To check that there are no invalid
items in L, I could check the value of any(map(is_invalid, L)).
But this approach is suboptimal in the sense that, no matter what
L is, is_invalid will be
On 22/03/2010 14:45, kj wrote:
I have a list of items L, and a test function is_invalid that checks
the validity of each item. To check that there are no invalid
items in L, I could check the value of any(map(is_invalid, L)).
But this approach is suboptimal in the sense that, no matter what
L is
I have a list of items L, and a test function is_invalid that checks
the validity of each item. To check that there are no invalid
items in L, I could check the value of any(map(is_invalid, L)).
But this approach is suboptimal in the sense that, no matter what
L is, is_invalid will be executed
12 matches
Mail list logo