How can you copy (clone) a string?
piet at cs.uu.nl
piet at cs.uu.nl
Fri Oct 6 07:27:19 EDT 2000
>>>>> aahz at panix.com (Aahz Maruch) (AM) schrijft:
AM> In article <u4s2rwts1.fsf at cs.uu.nl>, <piet at cs.uu.nl> wrote:
>>
>> i = 0
>> s = 1000 * 'x'
>> mem = None
>> while 1:
>> i = i+1
>> mem = (mem, s+`i`)
AM> Blech. If you're going to do a trick like that, just use a list.
Why? What's wrong with a tuple?
I used the tuple because a list would grow and would temporarily occupy
double the space while growing.
--
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl
More information about the Python-list
mailing list