turning callback into generator

Peter Otten __peter__ at web.de
Mon Sep 6 17:24:17 EDT 2004


Wai Yip Tung wrote:

> I'm attempting to turn some process than uses callback to return result
> into a more user friendly generator. I'm hitting some road block so any
> pointer would be appriciated.

I asked the same question a while back and there were no satisfying
suggestions.

http://mail.python.org/pipermail/python-list/2003-December/197726.html

At the very least you need threads, and when the generator is not fully
exhausted it's easy to end up with a thread waiting forever. 

I finally dropped the idea, but if you are really determined and want to
hack something together, the following might (or might not, this is really
a shot in the dark) serve as a starting point:

http://mail.python.org/pipermail/python-list/2003-July/173872.html

Peter




More information about the Python-list mailing list