Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: Design thought for callbacks Date: Tue, 24 Feb 2015 18:45:18 +1300 Lines: 17 Message-ID: References: <33677AE8-B2FA-49F9-9304-C8D93784255D@gmail.com> <54e8af1b$0$12976$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net vR5m7FOhLKC+bONjpuTRGAyOlZVwF62DqbzMQLoBoyZp6SgeA7 Cancel-Lock: sha1:nZGem32bo1nXdO+mSGI9Xa0dSpA= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:86296 Cem Karan wrote: > On Feb 22, 2015, at 5:15 AM, Gregory Ewing > wrote: > >> Perhaps instead of registering a callback function, you should be >> registering the listener object together with a method name. > > I see what you're saying, but I don't think it gains us too much. If I store > an object and an unbound method of the object, or if I store the bound method > directly, I suspect it will yield approximately the same results. It would be weird and unpythonic to have to register both an object and an unbound method, and if you use a bound method you can't keep a weak reference to it. -- Greg