Re: Turning a callback function into a generator
- From: Peter Otten <__peter__@xxxxxx>
- Date: Mon, 03 Jul 2006 09:19:16 +0200
Kirk McDonald wrote:
Let's say I have a function that takes a callback function as a
parameter, and uses it to describe an iteration:
def func(callback):
for i in [1, 2, 3, 4, 5]:
callback(i)
For the sake of argument, assume the iteration is something more
interesting than this which relies on the callback mechanism. The
function is an existing interface, and I cannot change it.
I want to somehow, in some way, provide an iteration interface to this
function. Thoughts?
I don't think there is a robust solution, see
http://groups.google.com/group/comp.lang.python/browse_frm/thread/0ce55373f128aa4e/1d27a78ca6408134?&hl=en
aka http://mail.python.org/pipermail/python-list/2003-December/197726.html
http://groups.google.com/group/comp.lang.python/browse_frm/thread/5793298a1ce93292/9230ddcc55d84694?&hl=en
aka http://mail.python.org/pipermail/python-list/2004-September/239025.html
Peter
.
- Follow-Ups:
- Re: Turning a callback function into a generator
- From: cmdrrickhunter@xxxxxxxx
- Re: Turning a callback function into a generator
- References:
- Turning a callback function into a generator
- From: Kirk McDonald
- Turning a callback function into a generator
- Prev by Date: Re: Tkinter function variable passing
- Next by Date: Re: conecting with a MsAcces DB by dao
- Previous by thread: Turning a callback function into a generator
- Next by thread: Re: Turning a callback function into a generator
- Index(es):