Commit ea2d3894 authored by Georg Brandl's avatar Georg Brandl

#8012: clarification in generator glossary entry.

parent 677fdec8
...@@ -217,6 +217,8 @@ Glossary ...@@ -217,6 +217,8 @@ Glossary
performs garbage collection via reference counting and a cyclic garbage performs garbage collection via reference counting and a cyclic garbage
collector that is able to detect and break reference cycles. collector that is able to detect and break reference cycles.
.. index:: single: generator
generator generator
A function which returns an iterator. It looks like a normal function A function which returns an iterator. It looks like a normal function
except that values are returned to the caller using a :keyword:`yield` except that values are returned to the caller using a :keyword:`yield`
...@@ -230,7 +232,7 @@ Glossary ...@@ -230,7 +232,7 @@ Glossary
.. index:: single: generator expression .. index:: single: generator expression
generator expression generator expression
An expression that returns a generator. It looks like a normal expression An expression that returns an iterator. It looks like a normal expression
followed by a :keyword:`for` expression defining a loop variable, range, followed by a :keyword:`for` expression defining a loop variable, range,
and an optional :keyword:`if` expression. The combined expression and an optional :keyword:`if` expression. The combined expression
generates values for an enclosing function:: generates values for an enclosing function::
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment