473,396 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Advice needed on __del__

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é

Jul 19 '05 #1
0 967

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kepes Krisztian | last post by:
Hi ! I very wonder, when I get exp. in java with GC. I'm Delphi programmer, so I get used to destructorin objects. In Java the final method is not same, but is like to destructor (I has...
6
by: Peter Abel | last post by:
I have an application, which is an instance of a class with a deeply nested object hierarchy. Among others one method will be executed as a thread, which can be stopped. Everything works fine...
13
by: Emmanuel | last post by:
Hi, I run across this problem, and couldn't find any solution (python 2.2.2) : Code : =========== from __future__ import generators >>> class titi:
1
by: schwerdy | last post by:
Hello developers! I'm using Python 2.3.4 under debian Sarge and want to write a small logger class. My source code reads: #*************************************************** import sys, time...
2
by: Mike C. Fletcher | last post by:
I'm looking at rewriting parts of Twisted and TwistedSNMP to eliminate __del__ methods (and the memory leaks they create). Looking at the docs for 2.3's weakref.ref, there's no mention of whether...
2
by: Alex VanderWoude | last post by:
I am attempting to save my window's size and position when it closes. So I figured I'd put some code in the __del__() method: from wxPython import * class MyWindow(wxFrame): def __init__(self,...
0
by: phil | last post by:
> you haven't answered my question, btw: why are you using __del__ > to do something that the garbage collector should do for you? After more reading it seems I have made an ass of my self on...
1
by: Erwan Adam | last post by:
Hello all, Can someone reproduce this bug ... I use : python Python 2.4.3 (#2, Sep 18 2006, 21:07:35) on linux2 Type "help", "copyright", "credits" or "license" for more information. ...
6
by: George Sakkis | last post by:
I'm baffled with a situation that involves: 1) an instance of some class that defines __del__, 2) a thread which is created, started and referenced by that instance, and 3) a weakref proxy to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.