[Python-Dev] yield * (Re: Missing operator.call)

Guido van Rossum guido at python.org
Sat Feb 7 19:25:54 CET 2009


We already have yield expressions and they mean something else...

On Sat, Feb 7, 2009 at 1:04 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>
>> It would be way too confusing to have "a different form of call" with
>> totally different semantics that nevertheless used the same
>> *terminology* as is used for regular calls.
>
> I expect you're right, so I won't argue for calling
> it "call" any more.
>
> I'd still like to find a good name for it, though.
> The other important thing is that my proposed construct
> should be usable as an expression, and its value
> should be whatever is returned by the called generator
> when it exits. E.g. if we continue spelling it
> "yield *" for the moment, then
>
>  def f():
>    v = yield *g()
>    print v
>
>  def g():
>    yield 42
>    return "spam"
>
>  for x in f():
>    pass
>
> should end up printing "spam".
>
> Would you entertain the idea of a "yield *" expression
> with those semantics?
>
> --
> Greg
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>



-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list