Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'laura': 0.07; '22,': 0.09; 'answering': 0.09; 'apis': 0.09; 'creighton': 0.09; 'things,': 0.09; 'trees': 0.09; 'cc:addr:python-list': 0.11; 'behave': 0.16; 'caches': 0.16; 'fine.': 0.16; 'nodes': 0.16; 'stuff,': 0.16; 'surprising': 0.16; 'with?': 0.16; 'for?': 0.16; 'do,': 0.16; 'language': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'library': 0.18; 'trying': 0.19; 'seems': 0.21; 'feb': 0.22; 'coding': 0.22; 'tests': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'documented': 0.24; 'driven': 0.24; 'regardless': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'references': 0.26; 'asking': 0.27; 'header:In- Reply-To:1': 0.27; "doesn't": 0.30; 'cool': 0.30; 'said,': 0.30; 'strongly': 0.30; "i'm": 0.30; 'easier': 0.31; 'documenting': 0.31; 'writes:': 0.31; 'there.': 0.32; 'stuff': 0.32; 'problem': 0.35; 'agree': 0.35; 'possible.': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'building': 0.35; 'there': 0.35; 'much.': 0.36; 'doing': 0.36; 'charset:us-ascii': 0.36; 'similar': 0.36; 'example,': 0.37; 'two': 0.37; 'architecture': 0.38; 'message-id:@gmail.com': 0.38; 'pm,': 0.38; 'that,': 0.38; 'expect': 0.39; 'does': 0.39; 'aside': 0.39; 'bad': 0.39; 'sure': 0.39; 'how': 0.40; 'even': 0.60; 'new': 0.61; 'matter': 0.61; 'making': 0.63; 'header:Message-Id:1': 0.63; 'such': 0.63; 'more': 0.64; 'sound': 0.68; 'study': 0.69; 'surprise': 0.74; 'subject:Design': 0.78; '2015': 0.84; 'actually,': 0.84; 'polling': 0.84; 'subject:thought': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=TZx4jHYGRg9ZWWTW4gHJ/5IrJcLy1i2zXOKM3yQg7ek=; b=pJ0SMsv9wIbThDGHuCZz/kMMpGu5aquYlRIOrcsJL+DTXaX9iW6XSF0yktfqQZLkWh dm5NADpXBYv3eMEdImFkEHqMtSZLQHvPxcrUMyLFdV+eg9cfVGD8k+dD3E9hQf/9e5at ei9VVvS4tok6+FFfr0wsOKsO43eQi84/jKisSaSme8GCDHXIsVEsVP6/F5yPaqYg7VnP F883U+3d9eAlVVXVJdFn+fTBzz5lSk0zRfYY043LvH+b9QrjIcVN5w/aMKAkEUGMIkaS 2ZLb4rXn3eXpFq4yfSKtGFYbA/Pc6uFVu5/5A2f1o8HjGvqPSfW0MahKb/3bzB8ZT7uq OZkw== X-Received: by 10.52.250.6 with SMTP id yy6mr10064740vdc.45.1424692032644; Mon, 23 Feb 2015 03:47:12 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: Design thought for callbacks From: Cem Karan In-Reply-To: <201502222229.t1MMT7Dn029607@fido.openend.se> Date: Mon, 23 Feb 2015 06:47:10 -0500 Content-Transfer-Encoding: quoted-printable References: <33677AE8-B2FA-49F9-9304-C8D93784255D@gmail.com> <39813568-6DB8-4341-A130-C256CFF352EE@gmail.com> <54e8c017$0$13008$c3e8da3$5496439d@news.astraweb.com> <51947083-01AC-4D1E-ACBD-3C476446B527@gmail.com> <54EA43C8.2090309@stoneleaf.us> <87wq39hbq1.fsf@elektro.pacujo.net><0443FBDF-9FD0-492E-8486-03EBD0972C04@gmail.com> <201502222229.t1MMT7Dn029607@fido.openend.se> To: Laura Creighton X-Mailer: Apple Mail (2.1510) Cc: python-list@python.org 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: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424692040 news.xs4all.nl 2849 [2001:888:2000:d::a6]:44439 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:86207 On Feb 22, 2015, at 5:29 PM, Laura Creighton wrote: > In a message of Sun, 22 Feb 2015 17:09:01 -0500, Cem Karan writes: >=20 >> Documentation is a given; it MUST be there. That said, documenting >> something, but still making it surprising, is a bad idea. For >> example, several people have been strongly against using a WeakSet to >> hold callbacks because they expect a library to hold onto callbacks. >> If I chose not to do that, and used a WeakSet, then even if I >> documented it, it would still end up surprising people (and from the >> sound of it, more people would be surprised than not). >=20 >> Thanks, Cem Karan >=20 > No matter what you do, alas, will surprise the hell out of people > because callbacks do not behave as people expect. Among people who > have used callbacks, what you are polling is 'what are people > familiar with', and it seems for the people around here, now, > WeakSets are not what they are familiar with. And that's fine. I know that regardless of what I do, some people are = going to be surprised. I'm trying to develop APIs that reduce that = surprise as far as possible. That means I can spend more time coding = and less time answering questions... :) > 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. Actually, I use them when building caches of stuff, and I use weak = references when I have trees of stuff so the child nodes know of, but = don't hold onto, their parents. But I agree with you, there aren't a = huge number of use-cases. > The question I have is does this architecture make things harder, > easier or about the same to debug? To write tests for? to do Test > Driven Design with? Good questions! That was why I was asking about 'gotchas' with WeakSets = originally. Honestly, the only way to know for sure would be to write = two APIs for doing similar things, and then see how people react to = them. The problem is, how do you set up such a study so it is = statistically valid? Cem=