BJörn Lindqvist:
> While they
> may be faster, Psyco is great here. Also, if you have lots of 2d-loops
> like "for x in something: for y in something:", then it could be more
> beautiful to separate the iteration from the task:
>
> def iterimage(im, width, height, step = 1):
>     for y in range(0, height, step):
>         for x in range(0, width, step):
>             yield (x, y), im.getpixel((x, y))

Just a note: Psyco usually isn't able to speed up generators (ShedSkin
recently has hadded a support of them too, and it seem fast enough).

Bye,
bearophile

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to