[Tutor] Variables and constants [was Re: working with strings inpython3]

Marc Tompkins marc.tompkins at gmail.com
Tue Apr 19 23:55:33 CEST 2011


On Tue, Apr 19, 2011 at 2:37 PM, Joel Goldstick <joel.goldstick at gmail.com>wrote:

>
> On Tue, Apr 19, 2011 at 3:32 PM, <bodsda at googlemail.com> wrote:
>
>> And presumably cleans up the leftover object with the value of 42 when it
>> changes to point at the 43 object?
>>
>> Or does it leave all changes in memory until the program exits?
>>
>
> If a value has no name bound to it, python figures that out and destroys it
>

This is called "garbage collection" - one of those terms you may hear in the
background for ages before you realize what it refers to.  Automatic memory
allocation / garbage collection are among the greatest productivity
advantages in using languages like Python; your code probably won't be as
efficient as if you'd painstakingly written all the malloc()'s and free()'s
yourself, but you'll save many hours of drudgery - and far more importantly,
many many hours of debugging to find the places where you forgot something.

The other advantage, of course, is that Python is awesome.  But you knew
that already.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110419/e417e3ac/attachment.html>


More information about the Tutor mailing list