Yielding a chain of values

Peter Hansen peter at engcorp.com
Wed Aug 31 03:23:39 CEST 2005


Bengt Richter wrote:
> On Tue, 30 Aug 2005 23:12:35 +0200, Reinhold Birkenfeld <reinhold-birkenfeld-nospam at wolke7.net> wrote:
>>Bengt Richter wrote:
>>>Maybe
>>>         yield in inner()
>>>
>>>could be sugar for the above and become something optimized?
>>
>>The problem here is that yield isn't a statement any more. It's now an
>>expression, so it is not easy to find new syntax around it.
> 
> No, the idea was that it's still a statement, but what it
> yields is "in inner()" which UIAM is illegal now, and would
> signify "whatever sequence of elements is in inner()" --
> really yield in seq -- I don't know what inner() was, but I assumed
> an iterable.

I believe he was referring indirectly to 
http://www.python.org/peps/pep-0342.html (see item #1 in the 
"Specification Summary" section), where yield will become an expression. 
  This PEP has been accepted, thus his use of present tense, confusing 
though it is when it's not in the released version of Python yet.

Or I might be wrong. ;-)

-Peter



More information about the Python-list mailing list