Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6520d82f
Commit
6520d82f
authored
Feb 05, 2009
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#4992: next() method -> next() function.
parent
115fb350
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Doc/reference/simple_stmts.rst
Doc/reference/simple_stmts.rst
+3
-3
No files found.
Doc/reference/simple_stmts.rst
View file @
6520d82f
...
@@ -441,14 +441,14 @@ statement in a function definition is sufficient to cause that definition to
...
@@ -441,14 +441,14 @@ statement in a function definition is sufficient to cause that definition to
create a generator function instead of a normal function.
create a generator function instead of a normal function.
When a generator function is called, it returns an iterator known as a generator
When a generator function is called, it returns an iterator known as a generator
iterator, or more commonly, a generator. The body of the generator function is
iterator, or more commonly, a generator. The body of the generator function is
executed by calling the
generator's :meth:`next` method repeatedly until it
executed by calling the
:func:`next` function on the generator repeatedly until
raises an exception.
it
raises an exception.
When a :keyword:`yield` statement is executed, the state of the generator is
When a :keyword:`yield` statement is executed, the state of the generator is
frozen and the value of :token:`expression_list` is returned to :meth:`next`'s
frozen and the value of :token:`expression_list` is returned to :meth:`next`'s
caller. By "frozen" we mean that all local state is retained, including the
caller. By "frozen" we mean that all local state is retained, including the
current bindings of local variables, the instruction pointer, and the internal
current bindings of local variables, the instruction pointer, and the internal
evaluation stack: enough information is saved so that the next time :
meth
:`next`
evaluation stack: enough information is saved so that the next time :
func
:`next`
is invoked, the function can proceed exactly as if the :keyword:`yield`
is invoked, the function can proceed exactly as if the :keyword:`yield`
statement were just another external call.
statement were just another external call.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment