Re: [Python-Dev] __traceback__ and reference cycles

2005-08-09 Thread Samuele Pedroni
Tim Peters wrote: > > I can't think of a Python feature with a higher aggregate > braincell_burned / benefit ratio than __del__ methods. If P3K retains > them-- or maybe even before --we should consider taking "the Java > dodge" on this one. That is, decree that henceforth a __del__ method > wil

Re: [Python-Dev] __traceback__ and reference cycles

2005-08-08 Thread Tim Peters
[Brett Cannon] > Wasn't there talk of getting rid of __del__ a little while ago and > instead use weakrefs to functions to handle cleaning up? There was from me, yes, with an eye toward P3K. > Is that still feasible? It never was, really. The combination of finalizers, cycles and resurrection i

Re: [Python-Dev] __traceback__ and reference cycles

2005-08-08 Thread Tim Peters
[Tim Peters] >> If P3K retains them [__del__]-- or maybe even before --we should >> consider taking "the Java dodge" on this one. That is, decree that >> henceforth a __del__ method will get invoked by magic at most >> once on any given object O, no matter how often O is resurrected. [Phillip J.

Re: [Python-Dev] __traceback__ and reference cycles

2005-08-08 Thread Brett Cannon
On 8/8/05, Tim Peters <[EMAIL PROTECTED]> wrote: > I can't think of a Python feature with a higher aggregate > braincell_burned / benefit ratio than __del__ methods. If P3K retains > them-- or maybe even before --we should consider taking "the Java > dodge" on this one. That is, decree that henc

Re: [Python-Dev] __traceback__ and reference cycles

2005-08-08 Thread Phillip J. Eby
At 09:12 PM 8/8/2005 -0400, Tim Peters wrote: >I can't think of a Python feature with a higher aggregate >braincell_burned / benefit ratio than __del__ methods. If P3K retains >them-- or maybe even before --we should consider taking "the Java >dodge" on this one. That is, decree that henceforth a

Re: [Python-Dev] __traceback__ and reference cycles

2005-08-08 Thread Guido van Rossum
On 8/8/05, Tim Peters <[EMAIL PROTECTED]> wrote: > I can't think of a Python feature with a higher aggregate > braincell_burned / benefit ratio than __del__ methods. If P3K retains > them-- or maybe even before --we should consider taking "the Java > dodge" on this one. That is, decree that hence

Re: [Python-Dev] __traceback__ and reference cycles

2005-08-08 Thread Tim Peters
[Armin Rigo] > There are various proposals to add an attribute on exception instances > to store the traceback (see PEP 344). A detail not discussed, which I > thought of historical interest only, is that today's exceptions try very > hard to avoid reference cycles, in particular the cycle > > '

Re: [Python-Dev] __traceback__ and reference cycles

2005-08-08 Thread Guido van Rossum
On 8/8/05, Armin Rigo <[EMAIL PROTECTED]> wrote: > Attaching a __traceback__ will only make this "bug" show up more often, > as the 'except Exception, e' line in a __del__() method would be enough > to trigger it. Hmm... We can blame this on __del__ as much as on __traceback__, of course... But it

Re: [Python-Dev] __traceback__ and reference cycles

2005-08-08 Thread Armin Rigo
Hi, On Mon, Aug 08, 2005 at 10:31:06AM +0200, Armin Rigo wrote: > see the attached program... Oups. Here it is... Armin import sys, time def log(typ, val, tb): pass class X: def __del__(self): try: typo except Exception, e: e_type, e_value, e_t

[Python-Dev] __traceback__ and reference cycles

2005-08-08 Thread Armin Rigo
Hi all, There are various proposals to add an attribute on exception instances to store the traceback (see PEP 344). A detail not discussed, which I thought of historical interest only, is that today's exceptions try very hard to avoid reference cycles, in particular the cycle 'frame -> local