How can you copy (clone) a string?

Mike 'Cat' Perkonigg blablu at gmx.net
Tue Oct 3 10:27:21 EDT 2000


effbot at telia.com (Fredrik Lundh) wrote in 
<IZlC5.1602$d5.122653 at newsb.telia.net>:

>Max Møller Rasmussen wrote:
>> Just use slice:
>>
>> a = 'a'
>> b = a[:]
>
>>>> a = 'a'
>>>> b = a[:]
>>>> id(a)
>7834944
>>>> id(b)
>7834944
>>>> a is b
>1
>
></F>
>
>

LOL!
There seem to be a good optimization :-)

Regards,
Mike



More information about the Python-list mailing list