On Tue, Jul 30, 2013 at 2:10 PM, Andrew Fedoniouk
<[email protected]> wrote:
> On Tue, Jul 30, 2013 at 1:43 PM, Rick Waldron <[email protected]> wrote:
>> Or do you mean to say that generator functions and yield should be removed?
>
> In principle, with functions-as-collections the yield and the whole
> generators stuff
> is not needed. If functions can be used on the right of 'in' or 'of'
> in 'for' then
> all 'yield' use cases that I saw so far can be implemented without the yield.
> So why do we need redundant entities?

You don't understand what yield does.  It freezes the execution of the
function at that point, waiting until .next() is called to resume
execution.  This means you can do a number of very convenient things,
like yielding in the middle of a loop, or yielding within a try/catch
block.

You can't do these with simple functions without significant
refactoring.  The convenience of yield is well-established by Python.

~TJ
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to