[Python-Dev] Re: [Python-checkins]python/dist/src/Modules
gcmodule.c,2.33.6.5,2.33.6.6 (original) (raw)
Barry Warsaw barry@python.org
06 Apr 2003 18:03:32 -0400
- Previous message: [Python-Dev] Re: [Python-checkins]python/dist/src/Modules gcmodule.c,2.33.6.5,2.33.6.6
- Next message: [Python-Dev] Re: [Python-checkins]python/dist/src/Modulesgcmodule.c,2.33.6.5,2.33.6.6
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 2003-04-05 at 21:02, Jeremy Hylton wrote:
#1. (I think this was Fred's suggestion on Friday.) Don't do a hasattr() check on the object, do it on the class. This is what happens with new-style classes in Python 2.3: If a new-style class doesn't define an del method, then its instances don't have finalizer. It doesn't matter whether the specific instance has an del attribute.
FWIW, IIRC Jython does something vaguely like this. Actually the existance of del is check at class creation time because it's expensive to call del when the object is Java gc'd, and we use two different Java classes for classic class instances depending on whether it had a del or not. This means you can't add del to the class or the instance after the class is defined. Personally I think this is reasonable and I don't recall this biting anyone when I was working on Jython.
-Barry
- Previous message: [Python-Dev] Re: [Python-checkins]python/dist/src/Modules gcmodule.c,2.33.6.5,2.33.6.6
- Next message: [Python-Dev] Re: [Python-checkins]python/dist/src/Modulesgcmodule.c,2.33.6.5,2.33.6.6
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]