Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.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.045 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.01; 'cpython': 0.05; 'detect': 0.07; 'memory.': 0.07; '22,': 0.09; 'callback': 0.09; 'cc:addr :python-list': 0.11; 'blanket': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'work,': 0.20; 'feb': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'removed.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'thus': 0.29; "doesn't": 0.30; 'waste': 0.30; 'message-id:@mail.gmail.com': 0.30; 'along': 0.30; 'alone': 0.33; 'common': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'pm,': 0.38; 'rather': 0.38; 'how': 0.40; 'removing': 0.60; 'such': 0.63; 'prompt': 0.68; 'helping': 0.70; 'subject:Design': 0.78; '2015': 0.84; 'subject:thought': 0.84; 'wipe': 0.84; 'costs,': 0.91; 'why?': 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=loz/G+RnNZ6/fkigVs9y9AmTd4WoBF0win2tQ6OtOs8=; b=0HcbhKV9Hvlu1kVp5exPEpdF7v3suGCu6jCVVRwka9ODJQRtzOskpUvbKbS7zq8zMR oj1vB+ulRFCtZOdzGbf3YwbNN7mAXnWgvr0H2noLSqksFv0ddVEGJHdX4gPa99HG8TKe brE9jAFkWxUAufDslRauL1nr0vmYRxaGYdZEw3yK0RWk0JjrQ517+LA9FZqACOlhtkOi szKGo/z90wcwTNfKAnmxOI31TU2DXYhcZycmd4M04AknT0LKQbqdj+Wl2E98lSj+Urqy If6oM7tUslyYvfZhcaufFzrZZj92RMT9375Ft/CdGNRt99YA+2vBwvEnAgsJRB9kutTR G16A== MIME-Version: 1.0 X-Received: by 10.42.121.203 with SMTP id k11mr622329icr.59.1424595518617; Sun, 22 Feb 2015 00:58:38 -0800 (PST) In-Reply-To: <87mw46ibtq.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> <87mw46ibtq.fsf@elektro.pacujo.net> Date: Sun, 22 Feb 2015 19:58:38 +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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424595520 news.xs4all.nl 2914 [2001:888:2000:d::a6]:34131 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86089 On Sun, Feb 22, 2015 at 7:34 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> 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. > > Refloops are not to be worried about, let alone removed. Why? They force the use of the much slower cycle-detecting GC, rather than the quick and efficient CPython refcounter. I don't know how other Pythons work, but mark-and-sweep has its own costs, and I don't know of any system that's both prompt and able to detect refloops. Helping it along means your program doesn't waste memory. Why such a blanket statement? ChrisA