Multiple equates

CarlFK cfkarsten at gmail.com
Tue Nov 18 06:00:50 EST 2008


On Nov 17, 2:54 pm, cla... at lairds.us (Cameron Laird) wrote:
> In article <mailman.4155.1226950874.3487.python-l... at python.org>,
> Tim Chase  <python.l... at tim.thechases.com> wrote:
>                         .
>                         .
>                         .>To the OP, I think rather than cluttering my code, I'd just
> >create a loop
>
> >   for i in [x1,x2,x3,x4,...x1024]:
> >     a[i] = False
>
>                         .
>                         .
>                         .
> I much prefer this, too.
>
> I've been trying to decide if there's any sober reason to advocate
> the one-liner
>
>     map(lambda i: a.__setitem__(i, False), [x1, x2, x3, ..., x1024])
>
> My answer:  no.

well, the OP was "...faster?" not "best, cleanest, pythonic..."  so
the reason would be speed.

(looks faster, don't know for sure)
(and yeah, looks ugly.  but we need the speed...)

Carl K



More information about the Python-list mailing list