Re: Advice needed on __del__

2005-05-10 Thread Scott David Daniels
André Roberge wrote: > Scott David Daniels wrote: > >> André Roberge wrote: >> >>> ... Each time I refresh the screen, I could >>> force that call, then check to see if Evil has been >>> destroyed by Python, which would give me the information >>> I need to destroy Evil_twin behind the scene myse

Re: Advice needed on __del__

2005-05-10 Thread André Roberge
Fredrik Lundh wrote: > André Roberge wrote: >>If I need to have the user call Evil.destroy() as Evil >>is getting out of scope, it would miss the whole point >>of teaching about the natural way scope and namespace >>work. > > > well, if you insist on using finalizers to keep track of what's in th

Re: Advice needed on __del__

2005-05-10 Thread Fredrik Lundh
André Roberge wrote: > If I need to have the user call Evil.destroy() as Evil > is getting out of scope, it would miss the whole point > of teaching about the natural way scope and namespace > work. well, if you insist on using finalizers to keep track of what's in the current scope, I'd say that

Re: Advice needed on __del__

2005-05-10 Thread Sion Arrowsmith
=?ISO-8859-1?Q?Andr=E9_Roberge?= <[EMAIL PROTECTED]> wrote: >If I need to have the user call Evil.destroy() as Evil >is getting out of scope, it would miss the whole point >of teaching about the natural way scope and namespace >work. The problem, it seems to me, is that in Python "scope" applies

Re: Advice needed on __del__

2005-05-10 Thread Brian Quinlan
phil wrote: > I'm probably dense and don't quite get the point, even though I > have coded about 200,000 lines of Python and coded .5 million lines of > C before there was a C++ > > A class instance based language doesn't have to BE C++ to have a > destructor method. Very true. But meaningful fin

Re: Advice needed on __del__

2005-05-10 Thread flupke
phil wrote: > A class instance based language doesn't have to BE C++ to have a > destructor method. > > All I wanted to know is: is the apparent treatment of __del__ > which SEEMS to work fine for me in 2.3.4 deprecated or mangled > in some later release or future plans. > If someone doesn't kno

Re: Advice needed on __del__

2005-05-10 Thread André Roberge
stasz wrote: > On Mon, 09 May 2005 22:49:06 -0300, André Roberge wrote: > > >>Scott David Daniels wrote: >> >>>André Roberge wrote: >>> >>> ... Each time I refresh the screen, I could force that call, then check to see if Evil has been destroyed by Python, which would give me the inf

Re: Advice needed on __del__

2005-05-10 Thread stasz
On Mon, 09 May 2005 22:49:06 -0300, André Roberge wrote: > Scott David Daniels wrote: >> André Roberge wrote: >> >>>... Each time I refresh the screen, I could >>>force that call, then check to see if Evil has been >>>destroyed by Python, which would give me the information >>>I need to destroy

Re: Advice needed on __del__

2005-05-09 Thread Fredrik Lundh
"phil" wrote: > If someone doesn't know the answer to this question or if noone > knows the answer to this question there is no answer to your question. Python works as specified in the language specification, and the language specification makes no guarantees. changes in the CPython interpreter

Re: Advice needed on __del__

2005-05-09 Thread André Roberge
Scott David Daniels wrote: > André Roberge wrote: > >>... Each time I refresh the screen, I could >>force that call, then check to see if Evil has been >>destroyed by Python, which would give me the information >>I need to destroy Evil_twin behind the scene myself - >>which is what I am really af

Re: Advice needed on __del__

2005-05-09 Thread phil
> > Fredrik Lundh wrote: > >>Python is not C++. >> Praise the Lord. >> > > I dunno if this makes QOTW, but I vote we put this in our list text that > goes out with each and every list message. > > There will still be a lot of people who don't read it, but at least > we'll get to say, "We t

Re: Advice needed on __del__

2005-05-09 Thread Mike Meyer
phil <[EMAIL PROTECTED]> writes: > By the way, I understand that __del__ is only called when the last > reference to an instance is deled. That's fine, if consistent. Actually, __del__ is called when the instance is garbage collected. Exactly when that is is implementation dependent. In the impl

Re: Advice needed on __del__

2005-05-09 Thread Ivan Van Laningham
Hi All-- Fredrik Lundh wrote: > > Python is not C++. > I dunno if this makes QOTW, but I vote we put this in our list text that goes out with each and every list message. There will still be a lot of people who don't read it, but at least we'll get to say, "We told you so." -ly y'rs, Ivan;-)

Re: Advice needed on __del__

2005-05-09 Thread Scott David Daniels
André Roberge wrote: > ... Each time I refresh the screen, I could > force that call, then check to see if Evil has been > destroyed by Python, which would give me the information > I need to destroy Evil_twin behind the scene myself - > which is what I am really after. What might work is to keep

Re: Advice needed on __del__

2005-05-09 Thread André Roberge
Fredrik Lundh wrote: > André Roberge wrote: > > > >>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) > >

Re: Advice needed on __del__

2005-05-09 Thread Fredrik Lundh
"phil" wrote: > > Python makes no guarantees whatsover about when and how to > > run __del__, so relying on it to remove user-visible resources is a > > rather bad idea. > What does that mean? Is it a destructor or not? it's a finalizer. most Python implementations do a reasonable attempt to c

Re: Advice needed on __del__

2005-05-09 Thread Fredrik Lundh
André Roberge wrote: > 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) Python makes no guarantees whatsov