can someone explain the concept of "strings (or whatever) being immutable"
Gary Herron
gary.herron at islandtraining.com
Tue Jun 3 01:10:06 EDT 2014
On 06/02/2014 09:39 PM, Deb Wyatt wrote:
> a_string = "This is a string"
> a_string is pointing to the above string
>
> now I change the value of a_string
> a_string = "This string is different"
> I understand that now a_string is pointing to a different string than
> it was before, in a different location.
>
> my question is what happens to the original string?? Is it still in
> memory somewhere, nameless?
> Thanks in advance,
Yes, possibly, for a short while it will be nameless in memory
somewhere. If nothing else is pointing to it, it will eventually be
garbage collected.
Gary Herron
>
> ------------------------------------------------------------------------
> 3D Marine Aquarium Screensaver Preview
> <http://www.inbox.com/marineaquarium>
> *Free 3D Marine Aquarium Screensaver*
> Watch dolphins, sharks & orcas on your desktop! Check it out at
> www.inbox.com/marineaquarium <http://www.inbox.com/marineaquarium>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140602/e9dc4fbf/attachment.html>
More information about the Python-list
mailing list