[Tutor] How python keeps track of objects

Mitch Raful mitch.raful at gmail.com
Sun Nov 23 03:28:35 CET 2014


If I have code similar to this:

for object in objects:
    do_something(object)


def do_something(obj):
     other_object = Class( obj.property)
     other_object.method( arg1, arg2)

    do_stuff here with other_object
    if problem:
         print( obj.property )


My concern is that the for loop will wreak havoc with objects created in
the function do_something.  Do I need to use Threading for the
do_something?  Or does the interpreter keep track of all the
'other_object's as the for loop calls the function?

Thanks,

Mitch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141122/ec986df2/attachment-0001.html>


More information about the Tutor mailing list