[issue24088] yield expression confusion

2015-05-05 Thread Guido van Rossum

Changes by Guido van Rossum gu...@python.org:


--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24088
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24088] yield expression confusion

2015-05-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6e59d82d3d09 by Guido van Rossum in branch 'default':
Issue 24088: Clarify semantics of yield expression (merge from 3.4).
https://hg.python.org/cpython/rev/6e59d82d3d09

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24088
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24088] yield expression confusion

2015-05-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b87d96e0708e by Guido van Rossum in branch '3.4':
Issue 24088: Clarify semantics of yield expression.
https://hg.python.org/cpython/rev/b87d96e0708e

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24088
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24088] yield expression confusion

2015-05-04 Thread Jim Jewett

Jim Jewett added the comment:

OK, then how about

Current:

When a generator function is called, it returns an iterator known as a 
generator. That generator then controls the execution of a generator function. 
The execution starts when one of the generator’s methods is called.


Proposed:

When a generator function is called, it does not complete its execution 
immediately.  Instead, it keeps its execution frame intact, and returns a 
special kind of iterator known as a generator. The iteration starts when one of 
the generator’s methods is called, and the generator executes within the 
existing generator frame, rather than creating a new one.


This still seems to suggest that the generator uses the same frame as the 
generator function that created it; I was not aware that this was a guarantee.  
(Reusing the same frame, yes.  Reusing that particular frame, no.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24088
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24088] yield expression confusion

2015-05-04 Thread R. David Murray

R. David Murray added the comment:

I don't think anything about frames is guaranteed as part of the language, so 
I'm not sure that mention of it belongs in the description.  Personally, I find 
your reformulation more confusing that the original with 'a' replaced by 'the'.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24088
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24088] yield expression confusion

2015-05-01 Thread R. David Murray

R. David Murray added the comment:

Yes, and it is not using generator function in two different ways: it is 
literally the case that calling the generator function returns a generator 
object, which in turn controls the execution of the generator function.  The 
text then goes on to explain how this works.

I think it would make sense to change controls execution of a generator 
function to controls execution of the generator function, but I can't think 
of any other change that would make things clearer.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24088
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24088] yield expression confusion

2015-04-30 Thread Guido van Rossum

Guido van Rossum added the comment:

You can't just drop the middle sentence. Awkward though it is, it is attempting 
to describe that the generator object controls suspension and resumption of the 
stack frame representing execution of the generator function's body.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24088
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24088] yield expression confusion

2015-04-30 Thread Jim Jewett

New submission from Jim Jewett:

https://docs.python.org/3/reference/expressions.html#yield-expressions

Current:

When a generator function is called, it returns an iterator known as a 
generator. That generator then controls the execution of a generator function. 
The execution starts when one of the generator’s methods is called.


At a minimum, that seems to be using generator function in two different 
ways, but I think there are other problems.

Proposed:

When a generator function is called, it returns a special kind of iterator 
known as a generator. The iteration starts when one of the generator’s methods 
is called.


--
assignee: docs@python
components: Documentation, asyncio
messages: 242289
nosy: Jim.Jewett, docs@python, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: yield expression confusion
type: enhancement

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24088
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com