Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; '22,': 0.09; 'callback': 0.09; 'references,': 0.09; 'sure,': 0.09; 'cc:addr:python-list': 0.11; '6:52': 0.16; 'cleaned': 0.16; 'clears': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mean,': 0.16; 'none.': 0.16; 'routinely': 0.16; 'wrote:': 0.18; 'feb': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'instance,': 0.24; "shouldn't": 0.24; 'cc:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'specifically': 0.29; 'thus': 0.29; 'message- id:@mail.gmail.com': 0.30; 'bunch': 0.31; 'common': 0.35; 'received:google.com': 0.35; 'method': 0.36; 'pm,': 0.38; 'though,': 0.39; 'removing': 0.60; 'break': 0.61; 'special': 0.74; 'subject:Design': 0.78; '2015': 0.84; "it'd": 0.84; 'promptly.': 0.84; 'subject:thought': 0.84; 'wipe': 0.84; '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=oZlGIzrBgZBCUMf1cmDsnMVhH6msZ15pLSMWzsmx9YE=; b=Xjmo8s8bnoW6Tg0vbUCkIPW3DMjdYbIbgSSCnFQc84c5M/DMc2jeDJazwtxNSCmG5t /Q6xZesPte9YVhkfGx3IWi2Gx1h3HzSpKFb+1epgf4tyC7/hmuQo2vipWW8hCm8W8/ht zau9GzcPpK9Ojkz/195irg/cSYrGNV58lv8poMhBEXgPhZQR1QNUoW29T21ZhmluJ9ob Ps6jMXZ8o5nThsPlsbV/J7exK1nsxSEO5vlb++6hCi2zkwFvwSArzKC8P7mvsGmgmXe6 EVPGgI63fIufF+EgnOVOVv8nW7SwjU0J7PDZnr4GzGBAHzU2dafQHTGCJeNUXJRMnUFw vM0A== MIME-Version: 1.0 X-Received: by 10.50.61.238 with SMTP id t14mr6445337igr.34.1424593075971; Sun, 22 Feb 2015 00:17:55 -0800 (PST) In-Reply-To: <87r3tiids7.fsf@elektro.pacujo.net> References: <33677AE8-B2FA-49F9-9304-C8D93784255D@gmail.com> <87egpjapxv.fsf@elektro.pacujo.net> <54e9391b$0$13010$c3e8da3$5496439d@news.astraweb.com> <87r3tiids7.fsf@elektro.pacujo.net> Date: Sun, 22 Feb 2015 19:17:55 +1100 Subject: Re: Design thought for callbacks From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424593399 news.xs4all.nl 2873 [2001:888:2000:d::a6]:56611 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86087 On Sun, Feb 22, 2015 at 6:52 PM, Marko Rauhamaa wrote: > What I mean, though, is that you shouldn't think you need to create > object destructors where you routinely set all members to None. Sure, not *routinely*. It'd be a special case where it's not specifically a destructor, and its job is to break a reference cycle. For instance, you might have a close() method that clears out a bunch of references, which will then allow everything to get cleaned up promptly. Or (a very common case for me) a callback saying "remote end is gone" (eg on a socket) might wipe out the callbacks, thus removing their refloops. ChrisA