[Tutor] How python keeps track of objects

Danny Yoo danny.yoo at gmail.com
Sun Nov 23 23:33:02 CET 2014


On Nov 23, 2014 8:48 AM, "Mitch Raful" <mitch.raful at gmail.com> wrote:
>
> Thanks for the replies.   My concern was as the for loop keeps sending
objects into the do_something() function which uses the same reference name
other_object and that the previously instantiated other_objected would be
mutated if the function wasn't finished.  Or do all languages keep each
call to a function in its own memory space and there is not a collision?.

Each call has its own stack of activation records (also known as
"frames").  Temporary variables are localized to the activation records.
Otherwise we would have run into severe issues.  Recursion, for example,
would be much more difficult to write.

If you are talking about threads, then each thread has its own stack of
activation records.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141123/965b799a/attachment.html>


More information about the Tutor mailing list