How can you copy (clone) a string?

Makhno mak at imakhno.freeserve.co.uk
Thu Oct 5 07:30:15 EDT 2000


>i = 0
>s = 1000 * 'x'
>mem = None
>while 1:
>    i = i+1
>    mem = (mem, s+`i`)
>
>might work (untested)

>From the look of it, it will stop when approximately half the memory
resource is used up, as the string needs to be copied to be enlarged.







More information about the Python-list mailing list