Packing data
Jeff Shannon
jeff at ccvcorp.com
Thu May 2 16:37:44 EDT 2002
In article <kuk7qm8r3z.fsf at lasipalatsi.fi>, Erno Kuusela says...
> % python ding.py
> <function listcomp_test at 1482a4> 6.82
> <function map_test at 1482d4> 1.83
> python ding.py 17.44s user 0.16s system 98% cpu 17.897 total
>
> the map version is also more readable, imho.
Hm, I'm slightly surprised that there's that significant of a
difference in this case. Just goes to further reinforce that
performance needs to be measured, not guessed at. :)
And I won't deny that in this case, the map version is quite
readable. Other cases are not necessarily so, and I generally
prefer reading list comps, but this is largely a matter of taste.
(Of course, if performance is a *true* issue, then it's necessary
to try both and see which performs best in the particular
circumstance, because the answer can vary either way.)
Not that I think that Erno doesn't already know this, I'm merely
elucidating for others who might be following along. :)
--
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list