Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #86155
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.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.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'programmer': 0.03; 'say,': 0.05; '22,': 0.09; 'bug.': 0.09; 'callback': 0.09; 'naturally': 0.09; 'api': 0.11; 'cc:addr:python- list': 0.11; 'bug': 0.12; '(just': 0.16; 'garbage': 0.16; 'ideally,': 0.16; 'other:': 0.16; 'pythonic': 0.16; 'set,': 0.16; 'subclasses': 0.16; 'unexpected': 0.16; 'prevent': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'library': 0.18; "hasn't": 0.19; 'possible,': 0.19; 'feb': 0.22; 'code,': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'decide': 0.24; 'earlier': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'least': 0.26; 'somewhere': 0.26; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'forgot': 0.30; 'evil': 0.31; "they'll": 0.31; 'bugs': 0.33; 'guess': 0.33; 'moment': 0.34; 'problem': 0.35; "can't": 0.35; 'agree': 0.35; 'possible.': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'really': 0.36; 'library.': 0.36; 'set.': 0.36; 'example,': 0.37; 'message-id:@gmail.com': 0.38; 'pm,': 0.38; 'delete': 0.39; 'either': 0.39; 'called': 0.40; 'read': 0.60; 'new': 0.61; "you're": 0.61; 'header:Message-Id:1': 0.63; 'happen': 0.63; 'more': 0.64; 'occur': 0.65; 'relatively': 0.65; 'gotten': 0.74; 'obvious': 0.74; 'goal': 0.75; 'behavior': 0.77; 'subject:Design': 0.78; 'bitten': 0.84; 'ethan': 0.84; 'furman': 0.84; 'rising': 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=tqoVFIYGWs7FihQ8CdCLx37+FMiCNrrwcLuH+WcLmxM=; b=UK72p9kZGzUKZacB2G8QincSJxf8TkyuQgxJxDzcG2GHQvsXJbSqh+1NY2q2tn9ayo v60HgbhomEtLta/XAhDHZtsDApCo2CqGCGM8V5/sUrdBA8sdAaQrprKusdszHHYlOVXm MVvJFXQ4OXYh1+vpYkEmKsf9Sbddh5JGqf2sIg8mzizvY40ftxrxFWQ7ZGH40wsxLrDa R8ohfBI48RtMWY0M8eGKAvCFi2gey+/0sGL3DvUTgVgRFRyl+yNRir8avGL9R78DGH5T X6FGe1OAbZVUHpEgrJflgl7b//TVC6VjdN7pvS1GY6S4949f9Fyura5Mj73Vs/Kg9021 9iog== |
| X-Received | by 10.52.249.180 with SMTP id yv20mr7843190vdc.18.1424639842972; Sun, 22 Feb 2015 13:17:22 -0800 (PST) |
| Content-Type | text/plain; charset=iso-8859-1 |
| 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 | <54EA43C8.2090309@stoneleaf.us> |
| Date | Sun, 22 Feb 2015 16:17:21 -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> |
| To | Ethan Furman <ethan@stoneleaf.us> |
| 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.19029.1424639844.18130.python-list@python.org> (permalink) |
| Lines | 42 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1424639844 news.xs4all.nl 2834 [2001:888:2000:d::a6]:42610 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:86155 |
Show key headers only | View raw
On Feb 22, 2015, at 4:02 PM, Ethan Furman <ethan@stoneleaf.us> wrote: > On 02/22/2015 05:13 AM, Cem Karan wrote: > >> Output: >> From Evil Zombie: Surprise! >> From Your Significant Other: Surprise! >> >> In this case, the user made an error (just as Marko said in his earlier message), >> and forgot about the callback he registered with the library. The callback isn't >> really rising from the dead; as you say, either its been garbage collected, or it >> hasn't been. However, you may not be ready for a callback to be called at that >> moment in time, which means you're surprised by unexpected behavior. > > But the unexpected behavior is not a problem with Python, nor with your library -- it's a bug in the fellow-programmer's > code, and you can't (or at least shouldn't) try to prevent those kinds of bugs from manifesting -- they'll just get > bitten somewhere else by the same bug. I agree with you, but until a relatively new programmer has gotten used to what callbacks are and what they imply, I want to make things easy. For example, if the API subclasses collections.abc.MutableSet, and the documentation states that you can only add callbacks to this particular type of set, then a new programmer will naturally decide that either a) they need to dispose of the set, and if that isn't possible, then b) they need to delete their callback from the set. It won't occur to them that their live object will just magically 'go away'; its a member of a set! 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. Thanks, Cem Karan
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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