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


Groups > comp.lang.python > #86100

Re: Design thought for callbacks

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; '21,': 0.07; 'correct.': 0.07; '22,': 0.09; 'callback': 0.09; 'chunk': 0.09; 'e.g.,': 0.09; 'terminates': 0.09; 'cc:addr:python-list': 0.11; 'gui': 0.12; 'closed,': 0.16; 'expects': 0.16; 'somewhere.': 0.16; 'uncommon': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'chris': 0.29; 'am,': 0.29; "i'm": 0.30; 'program,': 0.31; 'code': 0.31; 'breaking': 0.31; 'information?': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'returning': 0.36; 'done': 0.36; 'charset:us-ascii': 0.36; 'message-id:@gmail.com': 0.38; 'window': 0.38; 'handle': 0.38; 'little': 0.38; 'how': 0.40; 'most': 0.60; 'simple': 0.61; "you're": 0.61; 'making': 0.63; 'header:Message-Id:1': 0.63; 'to:addr:gmail.com': 0.65; 'close': 0.67; 'subject:Design': 0.78; '2015': 0.84; 'everything.': 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=fCBBiEPLKJbS+AjVWfZtmMkKHREdAoYF3JKg8J3RMjU=; b=MlfMi4ghIN9nVHw3DbrRWsKsIYzyndhJYqn1zVAfl94IoaZgmVLdJgNOTb/kfQ6Ddd /7I+0/0aw/SVyzZ/kxiYy28lii1IztSp2pJRqTmjuOZo+OccUJPs69ykHJ83g+E8Hvcz Y+iizv7oQYh+G/B55Bn3QkAE2S4bL4oClslc8DkTPrE8C8qzIyTGcGQN0PKMJEplYadX TQSKsyowaIN4wgoNxFVlhr1uydGxpfUzFlgLgnK1ikVXn0n3PEejaR/fgGMOkRg2Rgfw 614AUddOz7QAf3R6qZ3CbZ1isGfhPpxrjBUkzZIWsHJWSYnpjXah01peAu9MWh6C1QHw 2LkQ==
X-Received by 10.52.181.33 with SMTP id dt1mr6240948vdc.42.1424606839590; Sun, 22 Feb 2015 04:07:19 -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 <CAPTjJmoZsB8=xpadFp_S5TFqHcSjW9kO-SfmJzM2dLvq+yCPRA@mail.gmail.com>
Date Sun, 22 Feb 2015 07:07:17 -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> <BB15CAE6-4C31-4544-A9DE-DC9D6F827B45@gmail.com> <CAPTjJmrA2suEdKDZkn44Xxsq4m_mZ=Jf6C19GvBjoBfCaTEyzg@mail.gmail.com> <C82546F4-1CBB-4D83-834F-CF1BAE52E8E9@gmail.com> <CAPTjJmoZsB8=xpadFp_S5TFqHcSjW9kO-SfmJzM2dLvq+yCPRA@mail.gmail.com>
To Chris Angelico <rosuav@gmail.com>
X-Mailer Apple Mail (2.1510)
Cc "comp.lang.python" <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.19001.1424606842.18130.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1424606842 news.xs4all.nl 2884 [2001:888:2000:d::a6]:52107
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:86100

Show key headers only | View raw


On Feb 21, 2015, at 10:55 AM, Chris Angelico <rosuav@gmail.com> wrote:

> On Sun, Feb 22, 2015 at 2:45 AM, Cem Karan <cfkaran2@gmail.com> wrote:
>> OK, so if I'm reading your code correctly, you're breaking the cycle in your object graph by making the GUI the owner of the callback, correct?  No other chunk of code has a reference to the callback, correct?
> 
> Correct. The GUI engine ultimately owns everything. Of course, this is
> a very simple case (imagine a little notification popup; you don't
> care about it, you don't need to know when it's been closed, the only
> event on it is "hit Close to destroy the window"), and most usage
> would have other complications, but it's not uncommon for me to build
> a GUI program that leaves everything owned by the GUI engine.
> Everything is done through callbacks. Destroy a window, clean up its
> callbacks. The main window will have an "on-deletion" callback that
> terminates the program, perhaps. It's pretty straight-forward.

How do you handle returning information?  E.g., the user types in a number and expects that to update the internal state of your code somewhere.

Thanks,
Cem Karan

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Design thought for callbacks Cem Karan <cfkaran2@gmail.com> - 2015-02-22 07:07 -0500

csiph-web