Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #72469

Re: can someone explain the concept of "strings (or whatever) being immutable"

Date 2014-06-02 22:10 -0700
From Gary Herron <gary.herron@islandtraining.com>
Subject Re: can someone explain the concept of "strings (or whatever) being immutable"
References <CB9E0AA79B1.00000B26codemonkey@inbox.com>
Newsgroups comp.lang.python
Message-ID <mailman.10591.1401772615.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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>
>
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: can someone explain the concept of "strings (or whatever) being immutable" Gary Herron <gary.herron@islandtraining.com> - 2014-06-02 22:10 -0700

csiph-web