Re: Turning a callback function into a generator

2006-07-03 Thread Alex Martelli
Kirk McDonald <[EMAIL PROTECTED]> wrote: ... > > def func(callback): > > for i in [1, 2, 3, 4, 5]: > > callback(i) ... > Threads are probably a weak point of mine. I have little experience with > them, and so I am inclined to paranoia while using them. What Paranoia is the cor

Re: Turning a callback function into a generator

2006-07-03 Thread Kirk McDonald
Alex Martelli wrote: > Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > > >>In article <[EMAIL PROTECTED]>, >> Kirk McDonald <[EMAIL PROTECTED]> wrote: >> >> >>>I want to somehow, in some way, provide an iteration interface to this >>>function. Thoughts? >> >>Run it in a separate thread/process?

Re: Turning a callback function into a generator

2006-07-03 Thread Alex Martelli
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Kirk McDonald <[EMAIL PROTECTED]> wrote: > > >I want to somehow, in some way, provide an iteration interface to this > >function. Thoughts? > > Run it in a separate thread/process? Sounds best to me. Specifical

Re: Turning a callback function into a generator

2006-07-03 Thread Kirk McDonald
[EMAIL PROTECTED] wrote: > Peter Otten wrote: > >>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) >>> > > > Which

Re: Turning a callback function into a generator

2006-07-03 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Kirk McDonald <[EMAIL PROTECTED]> wrote: >I want to somehow, in some way, provide an iteration interface to this >function. Thoughts? Run it in a separate thread/process? -- http://mail.python.org/mailman/listinfo/python-list

Re: Turning a callback function into a generator

2006-07-03 Thread [EMAIL PROTECTED]
Peter Otten wrote: > 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) > > Which object is immutable? the callback

Re: Turning a callback function into a generator

2006-07-03 Thread Peter Otten
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 > interes

Turning a callback function into a generator

2006-07-02 Thread Kirk McDonald
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 cal