Why doesn't deepcopy work on strings ?

Steven Taschuk staschuk at telusplanet.net
Sun Feb 23 23:07:09 EST 2003


Quoth Tony C:
> Why doesn't deepcopy() on a string make a deep copy of that string ?

Because there's no reason to copy a string: since they're
immutable, having two copies of the same characters doesn't allow
you to do anything you can't do with just one copy.  (It doesn't
create copies of ints either, for example.  See the source.)

Why do you want a copy of a string?

-- 
Steven Taschuk                                                 o- @
staschuk at telusplanet.net                                      7O   )
                                                               "  (





More information about the Python-list mailing list