[Python-Dev] Class destructor
Nick Maclaren
nmm1 at cus.cam.ac.uk
Wed Feb 28 19:00:55 CET 2007
"Phillip J. Eby" <pje at telecommunity.com> 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 certain purposes -- i.e. it's got a pointer and a callback.
Ah. Yes. Thanks for suggesting it - if it is the simplest way, I
may as well do it.
> You could of course also use weak references, but that's a bit more
> awkward as well.
Yes. And they aren't a technology I have used (in Python), so I would
have to find out about them. Attributes etc. I have already played
with.
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email: nmm1 at cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
More information about the Python-Dev
mailing list