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


Groups > comp.lang.python > #86167

Re: Design thought for callbacks

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.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.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'laura': 0.07; 'referring': 0.07; 'string': 0.09; 'creighton': 0.09; 'uses.': 0.09; 'will,': 0.09; 'cc:addr:python-list': 0.11; '23,': 0.16; 'flush': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'garbage': 0.16; 'instances,': 0.16; 'mapping;': 0.16; 'language': 0.16; 'wrote:': 0.18; 'feb': 0.22; 'memory': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'certainly': 0.24; 'refers': 0.24; 'mon,': 0.24; "haven't": 0.24; 'looks': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'player': 0.26; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'character': 0.29; 'room': 0.29; 'unix': 0.29; "doesn't": 0.30; 'cool': 0.30; 'message-id:@mail.gmail.com': 0.30; "they'll": 0.31; 'though.': 0.31; 'anyone': 0.31; 'common': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'much.': 0.36; 'mapping': 0.38; 'anything': 0.39; 'aside': 0.39; 'how': 0.40; 'new': 0.61; 'back': 0.62; 'guarantee': 0.63; 'more': 0.64; 'hang': 0.67; 'notices': 0.68; 'subject:Design': 0.78; '2015': 0.84; 'around,': 0.84; 'rooms': 0.84; 'subject:thought': 0.84; 'thing,': 0.91; 'to:none': 0.92; 'room,': 0.93
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=bce0j1Qpym8H8xubEDgeluRzWkUhgb3Zg+3PD+RcriI=; b=NTrktIPCNHqtbTeftOdNZIjxcb3Uk15iRZAS51SSpo+CnoxrixCEnmWw7TuAWUXqOu 2U1PB69mwJ4MwgFJKDJBNKxlWQa313uSsMdo8C/85iDMKepk7JuyF/LNyxDEC67IVrCd jwO+avOnsptypFT/1LVh1qOjPdR67mMLbcqSEhw2FAaaUgs8LLuarJpECgaIEb28sMKt Bk50avcjLxGbiqVuzYHsJTAQ3/dsTgJqOEvCNvxbnzEixR/nhs1HQ74vdIEOBcNTeqoq ul1VxKBd6Y1pE57lodB2YbChgpxcFAxTfjZqJFbe611Einew6u8doQN4HP8jD6cPw35z yr/Q==
MIME-Version 1.0
X-Received by 10.107.128.219 with SMTP id k88mr10082629ioi.27.1424644864217; Sun, 22 Feb 2015 14:41:04 -0800 (PST)
In-Reply-To <201502222229.t1MMT7Dn029607@fido.openend.se>
References <33677AE8-B2FA-49F9-9304-C8D93784255D@gmail.com> <CAPTjJmpEHQV2PpaZvszuTGn0_GNg0sWV6aLenbQsZrSXCy2YKQ@mail.gmail.com> <39813568-6DB8-4341-A130-C256CFF352EE@gmail.com> <CAPTjJmrfMowbK7z+eN7xfMv2Ck5peJpBPyBRHvhXM4-ocxRR6w@mail.gmail.com> <mailman.18962.1424527666.18130.python-list@python.org> <54e8c017$0$13008$c3e8da3$5496439d@news.astraweb.com> <51947083-01AC-4D1E-ACBD-3C476446B527@gmail.com> <54EA43C8.2090309@stoneleaf.us> <mailman.19029.1424639844.18130.python-list@python.org> <87wq39hbq1.fsf@elektro.pacujo.net> <cfkaran2@gmail.com> <0443FBDF-9FD0-492E-8486-03EBD0972C04@gmail.com> <201502222229.t1MMT7Dn029607@fido.openend.se>
Date Mon, 23 Feb 2015 09:41:04 +1100
Subject Re: Design thought for callbacks
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.19037.1424644873.18130.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1424644873 news.xs4all.nl 2900 [2001:888:2000:d::a6]:49266
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:86167

Show key headers only | View raw


On Mon, Feb 23, 2015 at 9:29 AM, Laura Creighton <lac@openend.se> wrote:
> But that is not so surprising.  How many people use WeakSets for
> _anything_?  I've never used them, aside from 'ooh! cool shiny
> new language feature!  Let's kick it around the park!'  That people
> aren't familiar with WeakSets doesn't mean all that much.

I haven't used weak *sets*, but I've used weak *mappings* on occasion.
It's certainly not a common thing, but they have their uses. I have a
MUD which must guarantee that there be no more than one instance of
any given room (identified by a string that looks like a Unix path),
but which will, if it can, flush rooms out of memory when nothing
refers to them. So it has a mapping from the path strings to the
instances, but with weak refs for the instances; if anything else is
referring to that instance (eg a player character in the room), it'll
hang around, and any time anyone else needs that room, they'll get the
same instance back from the mapping; but any time the garbage
collector notices that a room can be disposed of, it will be.

Definitely not common though.

ChrisA

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


Thread

Re: Design thought for callbacks Cem Karan <cfkaran2@gmail.com> - 2015-02-21 09:07 -0500
  Re: Design thought for callbacks Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-22 04:27 +1100
    Re: Design thought for callbacks Cem Karan <cfkaran2@gmail.com> - 2015-02-22 08:13 -0500
      Re: Design thought for callbacks Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-24 00:31 +1100
    Re: Design thought for callbacks Ethan Furman <ethan@stoneleaf.us> - 2015-02-22 13:02 -0800
    Re: Design thought for callbacks Cem Karan <cfkaran2@gmail.com> - 2015-02-22 16:17 -0500
      Re: Design thought for callbacks Marko Rauhamaa <marko@pacujo.net> - 2015-02-22 23:34 +0200
        Re: Design thought for callbacks Cem Karan <cfkaran2@gmail.com> - 2015-02-22 17:09 -0500
        Re: Design thought for callbacks Laura Creighton <lac@openend.se> - 2015-02-22 23:29 +0100
        Re: Design thought for callbacks Chris Angelico <rosuav@gmail.com> - 2015-02-23 09:41 +1100
        Re: Design thought for callbacks Cem Karan <cfkaran2@gmail.com> - 2015-02-23 06:47 -0500
        Re: Design thought for callbacks "Frank Millman" <frank@chagford.com> - 2015-02-23 14:29 +0200
        Re: Design thought for callbacks Cem Karan <cfkaran2@gmail.com> - 2015-02-24 06:00 -0500

csiph-web