Class is still something I struggle with. I think I'm finally starting to get my head wrapped around it, but the discussion in a different thread has sparked a question. First, please check my understanding: A class creates objects, it's like a template that allows me to create as many copies as I want of the object but allows me to have slightly different versions of the object by having different values for the variables within the object, which I can set with arguments? By using __init__ (self) I instantiate a new copy of the object?
Whether the above is correct or not (and do please correct me/ tutor me), my question is, if I create objects in a while True loop, do the objects get garbage collected, ie. disappear when the loop returns to the beginning and creates new versions of the objects? Psuedo code example: (presuming I have a class that creates a lemon, a lime and has a function that operates on them called juice) while True: lemon = yellow() # create a yellow object called lemon lime = green() # create a green object called lime drink = juice(lemon, lime) # operate on objects lemon and lime in a function called juice resident in the class So, using the above example, when the loop reaches the end and returns to the beginning, new lemons and limes are created, yes? What happens to the old ones? Or have I still got this completed boggled? regards, RIchard -- quando omni flunkus moritati
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor