On Mon, Oct 29, 2012 at 3:23 PM, Rene Nejsum <rene@stranden.com> wrote:
On Oct 29, 2012, at 5:59 PM, Yury Selivanov <yselivanov.ml@gmail.com> wrote:
On 2012-10-29, at 12:07 PM, Antoine Pitrou <solipsis@pitrou.net> wrote:
In the docstrings I use the prefix "COROUTINE:" to indicate public APIs that should be invoked using yield from.
Hmm, should they? Your approach looks a bit weird: you have functions that should use yield, and others that should use "yield from"? That sounds confusing to me.
I'd much rather either have all functions use "yield", or have all functions use "yield from".
(also, I wouldn't be shocked if coroutines had to wear a special decorator; it's a better marker than having the word COROUTINE in the docstring, anyway :-))
That's what bothers me is well. 'yield from' looks too long for a simple thing it does (1); users will be confused whether they should use 'yield' or 'yield from' (2); there is no visible difference between a plain generator and a coroutine (3).
I agree, was this ever commented ? I know it maybe late in the discussion but just because you can use yield/yield from for concurrent stuff, should you?
I explained my position on yield vs. yield from twice already in this thread. -- --Guido van Rossum (python.org/~guido)