Nested function scope problem

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Sat Jul 22 15:23:43 EDT 2006


Justin Azoff a écrit :
> Simon Forman wrote:
> 
>>That third option seems to work fine.
> 
> 
> Well it does, but there are still many things wrong with it
> 
(snip)

>     tok = ''
>     tok = toc + c
> should be written as
>     tok = []
>     tok.append(c)
> and later
>     ''.join(toc)

IIRC, string concatenation slowness has been fixed a few versions ago - 
at least in CPython - , so there's  no more reason to use this idiom.

(snip)



More information about the Python-list mailing list