On Tue, Sep 18, 2012 at 12:16 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > The __del__ method does not delete an object. Remember, objects are only > deleted when there are no references to it. Otherwise you could have some > code that tries to use a deleted object, and you would get a system crash > or BSOD.
There is a conceptually viable alternative: destroy an object immediately and force all references to it to become some sentinel value (eg None). Python currently doesn't have this, but it would be rather convenient at times. Could be part of a construct like 'with' to say "make this, use it, and then dispose of it". ChrisA -- http://mail.python.org/mailman/listinfo/python-list