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


Groups > comp.lang.python > #67015 > unrolled thread

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

Started byChris Angelico <rosuav@gmail.com>
First post2014-02-25 13:34 +1100
Last post2014-02-25 17:34 +1100
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

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

FromChris Angelico <rosuav@gmail.com>
Date2014-02-25 13:34 +1100
SubjectRe: [Baypiggies] Class decorator to capture the creation and deletion of objects
Message-ID<mailman.7337.1393295699.18130.python-list@python.org>
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

[toc] | [next] | [standalone]


#67024

Fromalex23 <wuwei23@gmail.com>
Date2014-02-25 15:26 +1000
Message-ID<leh9ij$4aa$2@dont-email.me>
In reply to#67015
On 25/02/2014 12:34 PM, Chris Angelico wrote:
> On Tue, Feb 25, 2014 at 1:24 PM, Alex Martelli <aleax@google.com> wrote:
>> 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.

Mind those attributions, Chris, it was actually Sangeeth Saravanaraj who 
wrote what you quoted. I'm preeeeetty sure Alex knows all about __del__ :)

[toc] | [prev] | [next] | [standalone]


#67028

FromChris Angelico <rosuav@gmail.com>
Date2014-02-25 17:34 +1100
Message-ID<mailman.7344.1393310044.18130.python-list@python.org>
In reply to#67024
On Tue, Feb 25, 2014 at 4:26 PM, alex23 <wuwei23@gmail.com> wrote:
> On 25/02/2014 12:34 PM, Chris Angelico wrote:
>>
>> On Tue, Feb 25, 2014 at 1:24 PM, Alex Martelli <aleax@google.com> wrote:
>>>
>>> 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.
>
>
> Mind those attributions, Chris, it was actually Sangeeth Saravanaraj who
> wrote what you quoted. I'm preeeeetty sure Alex knows all about __del__ :)

Whoops, yes. I deleted a header by mistake. Sorry Alex! And thanks
Alex for pulling me up on it. (We have a few of those situations.
Fortunately we have Steven and Stephen, otherwise we'd have a lot more
of it.)

ChrisA

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web