Vitja Makarov, 27.06.2011 22:31: > 2011/6/27 Stefan Behnel: >> PEP 380 ("yield from") recently went through the approval gate. >> >> http://www.python.org/dev/peps/pep-0380/ >> >> The implementation in CPython isn't rounded up yet and lots of tests are >> missing from the test suite. But it's agreed that it'll make it into 3.3, >> and we should try to support it as well. It's a really nice feature. > > Wow! Interesting thing. > I think that could be implemented but I think we should try to > optimize cython generators first.
Coming back to this, the way it's now implemented in CPython is using a new field "f_yieldfrom" in the frame that the coroutine implementation automatically delegates to. Cython's coroutine implementation could do the same thing, and even copy much of the original implementation, by adding a new field to the coroutine class and updating the send(), throw() and close() methods accordingly. The interesting changes are those in Objects/genobject.c and Python/ceval.c in this patch: http://bugs.python.org/file24214/f8349cbc1b26.diff That makes it look like most of the work is done for us already. Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel