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

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.04; 'resulting': 0.04; 'explicit': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; '__del__': 0.16; 'called.': 0.16; 'deleted;': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject: \n ': 0.16; 'subject:Baypiggies': 0.16; 'wrote:': 0.18; 'alex': 0.19; 'subject:] ': 0.20; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'entries': 0.24; 'cc:2**0': 0.24; 'query': 0.26; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; '25,': 0.31; 'object.': 0.31; 'table': 0.34; 'subject:the': 0.34; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'two': 0.37; 'being': 0.38; 'pm,': 0.38; 'that,': 0.38; 'system.': 0.39; 'guarantee': 0.63; 'name': 0.63; 'kind': 0.63; 'removal': 0.74; 'subject:Class': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=OWfeoG8B2Gkbf4HuATGKu/VFGKk21BzXQEMUv7sdL10=; b=uXbDDR9k2Yx41rCds1a/eR5sOSbbaak0e+UZeoRJUS240BdRNZyF21jeXXttkNIdZw HOGbXaWPL3T1JMfhIfRyFezScVFhlmy7c9xSD3iEoD4/vBin4T3MtXSVaSpTagogFjI0 cUK6EwsZ79tUtoDSlHfOVs5v36v9GqVBOZTpgoxfI02MgNy5HTPZUQQAsUrimrM20yyw cHBVgaPuFVXrBvY//jT4mWLbQ70t7ieaq8ZdJk0JpJAjcPS9CPe0LWL9LLDqLAPtsrgp uvKbyDvbTsok9N7lcA+XhuDcJEuZmDsJZlvrIXP04WTFuM9OIOEwkgf2ANYvvaOKU57R RAIA==
MIME-Version 1.0
X-Received by 10.68.112.164 with SMTP id ir4mr3290219pbb.153.1393295695395; Mon, 24 Feb 2014 18:34:55 -0800 (PST)
In-Reply-To <CAE46Be9Ght7zj3rk=40=fKNmASq_1ER96Xp4PaPXLuiyMmbD1A@mail.gmail.com>
References <CAPbKEUp_OS_PukUz2KObOSLQzjwGehPOfG4C-3Gq9qq=RaASgQ@mail.gmail.com> <CAE46Be9Ght7zj3rk=40=fKNmASq_1ER96Xp4PaPXLuiyMmbD1A@mail.gmail.com>
Date Tue, 25 Feb 2014 13:34:55 +1100
Subject Re: [Baypiggies] Class decorator to capture the creation and deletion of objects
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.7337.1393295699.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1393295699 news.xs4all.nl 2929 [2001:888:2000:d::a6]:35751
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:67015

Show key headers only | 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