Suppose I have two classes: 'Jekyll' and 'Hyde' that are related in a particular way.
When I create a Jekyll object, a Hyde one gets automatically created (and displayed on a screen). ==== drum roll to announce Python script === Nice = Jekyll() # Nice_twin, a Hyde object, gets created. Nice.doStuff() # Nice_twin is doing his own stuff def subplot(): Evil = Jekyll() # Evil_twin gets created and displayed Evil.doStuff() # Evil_twin does stuff on the screen subplot() #Evil.doMoreStuff() would raise an error, as it no longer exists # in this namespace; however, Evil_twin still displayed Nice.doMoreStuff() # continues to work. ==========End of script, and ask question======= Evil_twin is still displayed on the screen at the end. I would like for Evil_twin to disappear. (I would like for this Hyde, to hide .... ok, bad pun!) This morning I had the following thought: I can, when I create a Jekyll object, update an outside_list. If, somehow, I could update that list when a Jekyll object disappears (perhaps by using __del__, which I have never touched) that would solve my problem. I could check outside_list each time I update the screen display, and remove Evil_twin when Evil no longer exists. Any suggestions? I've already tried lots of things, but nothing works properly. Every attempt I make involves quite a bit of coding, as the real-life situation is a bit more complicated than what I explain here. So, before I try again, I thought I would ask the Collective Wisdom on this list. ------ André -- http://mail.python.org/mailman/listinfo/python-list