[SciPy-user] Re: vectorize(function)/arraymap did not return arrays?
Yichun Wei
yichunwe at usc.edu
Fri Jan 21 16:06:00 EST 2005
Well, I found list comprehension is actually fast enough.
res = [myconvolve(a[x,y], k[x,y]) for x in range(16) for y in range(16)]
which is much faster than
for x in range(16):
for y in range(16):
.....
This thread says that list comprehension could be comparable to map, or
even better if taking in to consideration the time calling helper
functions in map:
http://mail.python.org/pipermail/python-list/2005-January/259690.html
I did not try list comprehension earlier because I roughly remember I
was told that list comprehension is syntaxic suger of for loops...
Travis Oliphant wrote:
> Well, I don't know how difficult it would be to write such a general
> looping function --- I never tried to do it. It was not on my radar
> when I wrote arraymap.
>
> -Travis
Thanks!
- yichun
More information about the SciPy-User
mailing list