Re: [Python-Dev] Class destructor

2007-03-02 Thread Nick Maclaren
Sorry about a second message, but I mentioned this aspect earlier, and it is semi-independent. If I want to produce statistics, such as the times spent in various operations, I need a callback when the class is disposed of. Now, that WOULD be inconvenient to use the C object attribute callback, u

Re: [Python-Dev] Class destructor

2007-03-02 Thread Nick Maclaren
"Guido van Rossum" <[EMAIL PROTECTED]> wrote: > > Can you explain the reason for cleaning up in this scenario? Are you > rapidly creating and destroying temporary class objects? Why can't you > rely on the regular garbage collection process? Or does you class > create an external resource like a te

Re: [Python-Dev] Class destructor

2007-03-01 Thread Guido van Rossum
On 2/28/07, Nick Maclaren <[EMAIL PROTECTED]> wrote: > I am gradually making progress with my binary floating-point software, > but have had to rewrite several times as I have forgotten most of the > details of how to do it! After 30 years, I can't say I am surprised. > > But I need to clean up wo

Re: [Python-Dev] Class destructor

2007-02-28 Thread Nick Maclaren
"Phillip J. Eby" <[EMAIL PROTECTED]> wrote: > > Well, you could use a custom metaclass with a tp_dealloc or whatever. Yes, I thought of that, but a custom metaclass to provide one callback is pretty fair overkill! > But I just mainly meant that a PyCObject is almost as good as a weakref > for cer

Re: [Python-Dev] Class destructor

2007-02-28 Thread Phillip J. Eby
At 05:24 PM 2/28/2007 +, Nick Maclaren wrote: >I suppose that I could add a C object as an attribute that points to >a block of memory that contains copies of all my workspace pointers, >and use the object deallocator to clean up. If all else fails, I >will try that, but it seems a hell of a l

Re: [Python-Dev] Class destructor

2007-02-28 Thread Nick Maclaren
"Phillip J. Eby" <[EMAIL PROTECTED]> wrote: > > >But I need to clean up workspace when a class (not object) is > >deallocated. I can't easily use attributes, as people suggested, > >because there is no anonymous storage built-in type. I could subvert > >one of the existing storage types (buffer,

Re: [Python-Dev] Class destructor

2007-02-28 Thread Phillip J. Eby
At 09:00 AM 2/28/2007 +, Nick Maclaren wrote: >I am gradually making progress with my binary floating-point software, >but have had to rewrite several times as I have forgotten most of the >details of how to do it! After 30 years, I can't say I am surprised. > >But I need to clean up workspace

[Python-Dev] Class destructor

2007-02-28 Thread Nick Maclaren
I am gradually making progress with my binary floating-point software, but have had to rewrite several times as I have forgotten most of the details of how to do it! After 30 years, I can't say I am surprised. But I need to clean up workspace when a class (not object) is deallocated. I can't eas