Skip to content

Commit cf3fb25

Browse files
committed
Add :term: for generators.
1 parent bb75e4e commit cf3fb25

17 files changed

Lines changed: 47 additions & 46 deletions

Doc/howto/functional.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ disclaimer.)
1313
In this document, we'll take a tour of Python's features suitable for
1414
implementing programs in a functional style. After an introduction to the
1515
concepts of functional programming, we'll look at language features such as
16-
iterators and generators and relevant library modules such as :mod:`itertools`
17-
and :mod:`functools`.
16+
iterators and :term:`generator`\s and relevant library modules such as
17+
:mod:`itertools` and :mod:`functools`.
1818

1919

2020
Introduction

Doc/library/codecs.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,17 @@ utility functions:
242242
.. function:: iterencode(iterable, encoding[, errors])
243243

244244
Uses an incremental encoder to iteratively encode the input provided by
245-
*iterable*. This function is a generator. *errors* (as well as any other keyword
246-
argument) is passed through to the incremental encoder.
245+
*iterable*. This function is a :term:`generator`. *errors* (as well as any
246+
other keyword argument) is passed through to the incremental encoder.
247247

248248
.. versionadded:: 2.5
249249

250250

251251
.. function:: iterdecode(iterable, encoding[, errors])
252252

253253
Uses an incremental decoder to iteratively decode the input provided by
254-
*iterable*. This function is a generator. *errors* (as well as any other keyword
255-
argument) is passed through to the incremental decoder.
254+
*iterable*. This function is a :term:`generator`. *errors* (as well as any
255+
other keyword argument) is passed through to the incremental decoder.
256256

257257
.. versionadded:: 2.5
258258

Doc/library/compiler.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,5 +640,5 @@ The code generator is a visitor that emits bytecodes. Each visit method can
640640
call the :meth:`emit` method to emit a new bytecode. The basic code generator
641641
is specialized for modules, classes, and functions. An assembler converts that
642642
emitted instructions to the low-level bytecode format. It handles things like
643-
generator of constant lists of code objects and calculation of jump offsets.
643+
generation of constant lists of code objects and calculation of jump offsets.
644644

Doc/library/contextlib.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ Functions provided:
3939
foo
4040
</h1>
4141

42-
The function being decorated must return a generator-iterator when called. This
43-
iterator must yield exactly one value, which will be bound to the targets in the
44-
:keyword:`with` statement's :keyword:`as` clause, if any.
42+
The function being decorated must return a :term:`generator`-iterator when
43+
called. This iterator must yield exactly one value, which will be bound to
44+
the targets in the :keyword:`with` statement's :keyword:`as` clause, if any.
4545

4646
At the point where the generator yields, the block nested in the :keyword:`with`
4747
statement is executed. The generator is then resumed after the block is exited.

Doc/library/csv.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@ it is 8-bit-clean save for some problems with ASCII NUL characters. So you can
442442
write functions or classes that handle the encoding and decoding for you as long
443443
as you avoid encodings like UTF-16 that use NULs. UTF-8 is recommended.
444444

445-
:func:`unicode_csv_reader` below is a generator that wraps :class:`csv.reader`
445+
:func:`unicode_csv_reader` below is a :term:`generator` that wraps :class:`csv.reader`
446446
to handle Unicode CSV data (a list of Unicode strings). :func:`utf_8_encoder`
447-
is a generator that encodes the Unicode strings as UTF-8, one string (or row) at
447+
is a :term:`generator` that encodes the Unicode strings as UTF-8, one string (or row) at
448448
a time. The encoded strings are parsed by the CSV reader, and
449449
:func:`unicode_csv_reader` decodes the UTF-8-encoded cells back into Unicode::
450450

Doc/library/difflib.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
126126

127127
.. function:: context_diff(a, b[, fromfile][, tofile][, fromfiledate][, tofiledate][, n][, lineterm])
128128

129-
Compare *a* and *b* (lists of strings); return a delta (a generator generating
130-
the delta lines) in context diff format.
129+
Compare *a* and *b* (lists of strings); return a delta (a :term:`generator`
130+
generating the delta lines) in context diff format.
131131

132132
Context diffs are a compact way of showing just the lines that have changed plus
133133
a few lines of context. The changes are shown in a before/after style. The
@@ -181,8 +181,8 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
181181

182182
.. function:: ndiff(a, b[, linejunk][, charjunk])
183183

184-
Compare *a* and *b* (lists of strings); return a :class:`Differ`\ -style delta
185-
(a generator generating the delta lines).
184+
Compare *a* and *b* (lists of strings); return a :class:`Differ`\ -style
185+
delta (a :term:`generator` generating the delta lines).
186186

187187
Optional keyword parameters *linejunk* and *charjunk* are for filter functions
188188
(or ``None``):
@@ -242,8 +242,8 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
242242

243243
.. function:: unified_diff(a, b[, fromfile][, tofile][, fromfiledate][, tofiledate][, n][, lineterm])
244244

245-
Compare *a* and *b* (lists of strings); return a delta (a generator generating
246-
the delta lines) in unified diff format.
245+
Compare *a* and *b* (lists of strings); return a delta (a :term:`generator`
246+
generating the delta lines) in unified diff format.
247247

248248
Unified diffs are a compact way of showing just the lines that have changed plus
249249
a few lines of context. The changes are shown in a inline style (instead of
@@ -442,7 +442,7 @@ use :meth:`set_seq2` to set the commonly used sequence once and call
442442

443443
.. method:: SequenceMatcher.get_grouped_opcodes([n])
444444

445-
Return a generator of groups with up to *n* lines of context.
445+
Return a :term:`generator` of groups with up to *n* lines of context.
446446

447447
Starting with the groups returned by :meth:`get_opcodes`, this method splits out
448448
smaller change clusters and eliminates intervening ranges which have no changes.

Doc/library/dis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ Miscellaneous opcodes.
482482

483483
.. opcode:: YIELD_VALUE ()
484484

485-
Pops ``TOS`` and yields it from a generator.
485+
Pops ``TOS`` and yields it from a :term:`generator`.
486486

487487

488488
.. opcode:: IMPORT_STAR ()

Doc/library/exceptions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ The following exceptions are the exceptions that are actually raised.
152152

153153
.. exception:: GeneratorExit
154154

155-
Raise when a generator's :meth:`close` method is called. It directly inherits
156-
from :exc:`Exception` instead of :exc:`StandardError` since it is technically
157-
not an error.
155+
Raise when a :term:`generator`\'s :meth:`close` method is called. It
156+
directly inherits from :exc:`Exception` instead of :exc:`StandardError` since
157+
it is technically not an error.
158158

159159
.. versionadded:: 2.5
160160

Doc/library/itertools.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@ The superior memory performance is kept by processing elements one at a time
460460
rather than bringing the whole iterable into memory all at once. Code volume is
461461
kept small by linking the tools together in a functional style which helps
462462
eliminate temporary variables. High speed is retained by preferring
463-
"vectorized" building blocks over the use of for-loops and generators which
464-
incur interpreter overhead. ::
463+
"vectorized" building blocks over the use of for-loops and :term:`generator`\s
464+
which incur interpreter overhead. ::
465465

466466
def take(n, seq):
467467
return list(islice(seq, n))

Doc/library/os.path.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ write files see :func:`open`, and for accessing the filesystem see the
303303

304304
.. note::
305305

306-
The newer :func:`os.walk` generator supplies similar functionality and can be
307-
easier to use.
306+
The newer :func:`os.walk` :term:`generator` supplies similar functionality
307+
and can be easier to use.
308308

309309

310310
.. data:: supports_unicode_filenames

0 commit comments

Comments
 (0)