Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #67015

Re: [Baypiggies] Class decorator to capture the creation and deletion of objects

References <CAPbKEUp_OS_PukUz2KObOSLQzjwGehPOfG4C-3Gq9qq=RaASgQ@mail.gmail.com> <CAE46Be9Ght7zj3rk=40=fKNmASq_1ER96Xp4PaPXLuiyMmbD1A@mail.gmail.com>
Date 2014-02-25 13:34 +1100
Subject Re: [Baypiggies] Class decorator to capture the creation and deletion of objects
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.7337.1393295699.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Feb 25, 2014 at 1:24 PM, Alex Martelli <aleax@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.

ChrisA

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [Baypiggies] Class decorator to capture the creation and deletion of objects Chris Angelico <rosuav@gmail.com> - 2014-02-25 13:34 +1100
  Re: [Baypiggies] Class decorator to capture the creation and deletion of objects alex23 <wuwei23@gmail.com> - 2014-02-25 15:26 +1000
    Re: [Baypiggies] Class decorator to capture the creation and deletion of objects Chris Angelico <rosuav@gmail.com> - 2014-02-25 17:34 +1100

csiph-web