[Python-Dev] Re: [pygtk] How to delete Gtk objects (original) (raw)
Skip Montanaro skip@pobox.com (Skip Montanaro)
Wed, 10 Oct 2001 14:21:21 -0500
- Previous message: [Python-Dev] pickling subclasses of types (Re: [Python-checkins] CVS: python/dist/src/Lib xmlrpclib.py,1.11,1.12)
- Next message: [Python-Dev] Re: [pygtk] How to delete Gtk objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
(adding python-dev to this conversation because decisions about missing special methods vis a vis PEP 252/253 seem to me to definitely belong in that space.)
>> I think that there may be some problems with extended types and
>> __del__?
Matt> For example:
Matt> class myList(type([])):
Matt> def __del__(self):
Matt> print "list dealloced"
Matt> list = myList()
Matt> list.append("foo")
Matt> list.append("bar")
Matt> del list
Matt> never prints list delloced.
My guess (without examining any code) is that del is not implemented for new-style classes. There is this rather cryptic note at the end of PEP 253:
- open issues:
...
- do we need __coerce__, __del__?
...
which leads me to believe that del would not be called in the current implementation. If people are going to be subclassing more than the traditional builtin types I think del methods will have to be supported.
Skip
- Previous message: [Python-Dev] pickling subclasses of types (Re: [Python-checkins] CVS: python/dist/src/Lib xmlrpclib.py,1.11,1.12)
- Next message: [Python-Dev] Re: [pygtk] How to delete Gtk objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]