[Tutor] optimization: faster than for
elis aeris
hunter92383 at gmail.com
Sun Jul 1 22:26:17 CEST 2007
ugh, can someone who is online at this time give me some pointers on how to
read this?
i don't know how to look it up,
in is listed,
out is not, so i am not sure if this is python at all.
On 7/1/07, Eike Welk <eike.welk at gmx.net> wrote:
>
> On Sunday 01 July 2007 06:17, elis aeris wrote:
> > The for version, as claimed by
> >
> > http://www.python.org/doc/essays/list2str.html
>
> The fastest version of the algorithm is this one:
>
> In [4]:import array
>
> In [5]:def f7(list):
> .5.: return array.array('B', list).tostring()
> .5.:
>
> In [6]:f7([97, 98, 99])
> Out[6]:'abc'
>
>
> The implicit loop is the "tostring" function. It is written in C and
> it happens to perform the desired algorithm. So there is nothing
> magical about "implicit loops". It just means: Find a library
> function that is written in C and that performs your task.
>
> For manipulating images it means: Find some operations in PIL that do
> what you want, and don't look at pixel values.
>
> Kind regards,
> Eike.
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070701/40212689/attachment.htm
More information about the Tutor
mailing list