Speed issues
Chuck Esterbrook
echuck at mindspring.com
Sun Jan 16 15:57:32 EST 2000
What Stefan has shown should be _much_ faster because maps are generally faster than for loops.
Everyone on this thread should really check out this fascinating article which directly relates:
http://www.python.org/doc/essays/list2str.html
I found this in the FAQ, which I highly recommend as well:
http://www.python.org/doc/FAQ.html
-Chuck
Stefan Schwarzer wrote:
> Hi Gerrit,
>
> Gerrit Holl schrieb:
> > is an assigment slower than appending to a list?
> > [...]
> > What is faster? What do you prefer?
>
> In addition to that what others have said: What about (not tested)
>
> def f( s ):
> o = map( lambda c: chr( ord(c)/2 ), s )
> return string.join( o, '' )
>
> How will this compare?
>
> Stefan
More information about the Python-list
mailing list