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


Groups > comp.lang.python > #86038 > unrolled thread

Re: Design thought for callbacks

Started byDevin Jeanpierre <jeanpierreda@gmail.com>
First post2015-02-21 06:24 -0800
Last post2015-02-21 06:24 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Design thought for callbacks Devin Jeanpierre <jeanpierreda@gmail.com> - 2015-02-21 06:24 -0800

#86038 — Re: Design thought for callbacks

FromDevin Jeanpierre <jeanpierreda@gmail.com>
Date2015-02-21 06:24 -0800
SubjectRe: Design thought for callbacks
Message-ID<mailman.18965.1424528721.18130.python-list@python.org>
On Fri, Feb 20, 2015 at 9:42 PM, Chris Angelico <rosuav@gmail.com> wrote:
> No, it's not. I would advise using strong references - if the callback
> is a closure, for instance, you need to hang onto it, because there
> are unlikely to be any other references to it. If I register a
> callback with you, I expect it to be called; I expect, in fact, that
> that *will* keep my object alive.

For that matter, if the callback is a method, you need to hang onto
it, because method wrappers are generated on demand, so the method
would be removed from the valid callbacks instantly.

Weak references for callbacks are broken.

-- Devin

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web