[Python-ideas] Yet another alternative name for yield-from

Bruce Frederiksen dangyogi at gmail.com
Thu Apr 2 21:35:43 CEST 2009


Jacob Holm wrote:
> Bruce Frederiksen wrote:
>> Guido van Rossum wrote:
>>> but how about 'return from'?
>> or 'return finally'?(??) ...
>>
> Or what about "yield return"? That clearly marks the construct as 
> belonging in a generator. It also mixes well with the idea of a "yield 
> raise" that I mentioned in another mail (not a suggestion for this PEP).
Another strange one: 'close with X'.

This hinges on the 'close' method returning X and also that this could 
be done syntactically *without* making 'close' a reserved word by 
relying on 'with' already being a reserved word with very limited usage 
in the grammar:

    generator_return_stmt: NAME 'with' testlist

And then verify later that NAME is 'close' (or raise SyntaxError).

I'm not that familiar with Python's parser to know if it could handle 
this or not (LL vs. LR)...

-bruce frederiksen



More information about the Python-ideas mailing list