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


Groups > comp.lang.python > #86162

Re: Design thought for callbacks

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 <cfkaran2@gmail.com>
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 <cfkaran2@gmail.com>
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> <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>
To Marko Rauhamaa <marko@pacujo.net>
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 <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.19032.1424642945.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Feb 22, 2015, at 4:34 PM, Marko Rauhamaa <marko@pacujo.net> wrote:

> Cem Karan <cfkaran2@gmail.com>:
> 
>> 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.
> 
> 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.
> 
> 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

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