Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2a.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.131 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.74; '*S*': 0.00; '22,': 0.09; 'callback': 0.09; 'api': 0.11; 'cc:addr:python-list': 0.11; 'expert,': 0.16; 'ideally,': 0.16; 'pythonic': 0.16; 'semantics': 0.16; 'surprising': 0.16; 'unambiguous': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'library': 0.18; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'documented': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'said,': 0.30; 'strongly': 0.30; 'documenting': 0.31; 'there.': 0.32; 'guess': 0.33; 'possible.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'programming,': 0.36; 'charset:us-ascii': 0.36; 'detail': 0.37; 'example,': 0.37; 'message-id:@gmail.com': 0.38; 'thank': 0.38; 'pm,': 0.38; 'that,': 0.38; 'expect': 0.39; 'bad': 0.39; 'even': 0.60; 'read': 0.60; 'making': 0.63; 'header:Message-Id:1': 0.63; 'happen': 0.63; 'more': 0.64; 'sound': 0.68; 'user,': 0.69; 'obvious': 0.74; 'goal': 0.75; 'attention': 0.75; 'subject:Design': 0.78; 'asynchronous': 0.84; 'confusion.': 0.84; 'shield': 0.84; 'subject:thought': 0.84; 'novice': 0.91 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=x8h3l15PCEZx4tVBm4I2HObx9b1aqIaoGpA6/dqjZpM=; b=TndlGt95y4xA0EWBYSKYFtj+cIy6oC8S63vAvxbS1+wHq4sqHecLShKpx+pBhisXWV oREVtJfQJ8lb6VVM3demKy58groXbBsk9sj06kzZqdQ81QRR9o8CbJMKc1Kewb64R8WA hKwuAYu/cGjaFbo8VoxX7mKHHIrIRNOqkqYqkyJXfK8lSx3jWojwuzHk+mEqqPfsWT6k nXxdUTOJlPxvYHzK0BhBIsA14F0II+wK1+jIR2VkZrBPJlpgTnIU3QoC/AmbNRnvKLsU 94mpKSaABYjyYHkXBkUB+fHjxuam+867n1zeEvI5cOTa7BLBHF1sdYtldHyHln7LDzfh jD3w== X-Received: by 10.52.72.5 with SMTP id z5mr7801046vdu.78.1424642942213; Sun, 22 Feb 2015 14:09:02 -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: <87wq39hbq1.fsf@elektro.pacujo.net> Date: Sun, 22 Feb 2015 17:09:01 -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> To: Marko Rauhamaa 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424642945 news.xs4all.nl 2860 [2001:888:2000:d::a6]:60100 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86162 On Feb 22, 2015, at 4:34 PM, Marko Rauhamaa wrote: > Cem Karan : >=20 >> My goal is to make things as pythonic (whatever that means in this >> case) and obvious as possible. Ideally, a novice can more or less >> guess what will happen with my API without really having to read the >> documentation on it. >=20 > If you try to shield your user from the complexities of asynchronous > programming, you will only cause confusion. You will definitely need = to > document all nooks and crannies of the semantics of the callback API = and > your user will have to pay attention to every detail of your spec. >=20 > Your user, whether novice or an expert, will thank you for your > unambiguous specification even if it is complicated. 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). Thanks, Cem Karan=