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


Groups > comp.lang.python > #86162

Re: Design thought for callbacks

Subject Re: Design thought for callbacks
From Cem Karan <cfkaran2@gmail.com>
Date 2015-02-22 17:09 -0500
References (5 earlier) <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>
Newsgroups comp.lang.python
Message-ID <mailman.19032.1424642945.18130.python-list@python.org> (permalink)

Show all headers | 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