Why doesn't deepcopy work on strings ?

Peter Hansen peter at engcorp.com
Mon Feb 24 08:23:54 EST 2003


Sarat Venugopal wrote:
> 
> >>> s1='monty python'
> >>> s2=(s1+'x')[:-1]
> >>> s2
> 'monty python'
> >>> id(s1), id(s2)
> (15201944, 15097976)
> 
> ;-)

Oh, quick!  Let's patch deepcopy to do this with all strings!  ;-) ;-)

-Peter




More information about the Python-list mailing list