[Baypiggies] Class decorator to capture the creation and deletion of objects
rosuav at gmail.com
Tue Feb 25 03:34:55 CET 2014
On Tue, Feb 25, 2014 at 1:24 PM, Alex Martelli <aleax at google.com> wrote:
> del a1
> del a2
> del a3
> del b1
> del b2
> At this point, all entries in the table should be deleted; query should
> return an empty list!
You can't actually depend on del resulting in __del__ being called.
The two are tangentially related, but Python doesn't guarantee that
unbinding a name will result in the destruction of the object.
I recommend that, instead, you have some kind of explicit removal system.
More information about the Python-list