Callbacks to generators
ramen at lackingtalent.com
Tue Jun 8 20:18:31 CEST 2004
In article <mailman.685.1086664428.6949.python-list at python.org>, Robert Brewer wrote:
> Dave Benjamin wrote:
>> Is there a straightforward way to create a generator from a
>> function that takes a callback? [..snip..]
> You're not the first to tackle this problem:
> ...but no solution forthcoming.
Oh well, thanks for the useful link. That thread was illuminating.
I ended up switching to an iterator object, implementing "__iter__" and
"next" in a class that wraps around the process. This required a bit of
reworking since the algorithm changed from a push model (which I would
consider callbacks and generators to be) to a pull model.
Thanks, everyone, for the helpful responses.
.:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:.
: i'm half drunk on babble you transmit - soul coughing / true dreams :
More information about the Python-list