Skip to content

Commit dc1f06f

Browse files
author
georg.brandl
committed
Documentation for r5990[3567].
git-svn-id: http://svn.python.org/projects/python/trunk@59912 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 1a86e97 commit dc1f06f

5 files changed

Lines changed: 36 additions & 3 deletions

File tree

Doc/glossary.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,13 @@ Glossary
338338
mutable
339339
Mutable objects can change their value but keep their :func:`id`. See
340340
also :term:`immutable`.
341+
342+
named tuple
343+
A tuple subclass whose elements also are accessible as attributes via
344+
fixed names (the class name and field names are indicated in the
345+
individual documentation of a named tuple type, like ``TestResults(failed,
346+
attempted)``). Named tuple classes are created by
347+
:func:`collections.namedtuple`.
341348

342349
namespace
343350
The place where a variable is stored. Namespaces are implemented as

Doc/library/decimal.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,11 @@ also have a number of specialized methods:
333333

334334
.. method:: Decimal.as_tuple()
335335

336-
Return a tuple representation of the number: ``(sign, digit_tuple, exponent)``.
336+
Return a :term:`named tuple` representation of the number:
337+
``DecimalTuple(sign, digits, exponent)``.
338+
339+
.. versionchanged:: 2.6
340+
Use a named tuple.
337341

338342

339343
.. method:: Decimal.canonical()

Doc/library/difflib.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ use :meth:`set_seq2` to set the commonly used sequence once and call
344344

345345
Find longest matching block in ``a[alo:ahi]`` and ``b[blo:bhi]``.
346346

347-
If *isjunk* was omitted or ``None``, :meth:`get_longest_match` returns ``(i, j,
347+
If *isjunk* was omitted or ``None``, :meth:`find_longest_match` returns ``(i, j,
348348
k)`` such that ``a[i:i+k]`` is equal to ``b[j:j+k]``, where ``alo <= i <= i+k <=
349349
ahi`` and ``blo <= j <= j+k <= bhi``. For all ``(i', j', k')`` meeting those
350350
conditions, the additional conditions ``k >= k'``, ``i <= i'``, and if ``i ==
@@ -373,6 +373,9 @@ use :meth:`set_seq2` to set the commonly used sequence once and call
373373

374374
If no blocks match, this returns ``(alo, blo, 0)``.
375375

376+
.. versionchanged:: 2.6
377+
This method returns a :term:`named tuple` ``Match(a, b, size)``.
378+
376379

377380
.. method:: SequenceMatcher.get_matching_blocks()
378381

Doc/library/doctest.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,11 +1506,14 @@ DocTestRunner objects
15061506
.. method:: DocTestRunner.summarize([verbose])
15071507

15081508
Print a summary of all the test cases that have been run by this DocTestRunner,
1509-
and return a tuple ``(failure_count, test_count)``.
1509+
and return a :term:`named tuple` ``TestResults(failed, attempted)``.
15101510

15111511
The optional *verbose* argument controls how detailed the summary is. If the
15121512
verbosity is not specified, then the :class:`DocTestRunner`'s verbosity is used.
15131513

1514+
.. versionchanged:: 2.6
1515+
Use a named tuple.
1516+
15141517

15151518
.. _doctest-outputchecker:
15161519

Doc/library/inspect.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ Note:
214214
defined in the :mod:`imp` module; see the documentation for that module for
215215
more information on module types.
216216

217+
.. versionchanged:: 2.6
218+
Returns a :term:`named tuple` ``ModuleInfo(name, suffix, mode,
219+
module_type)``.
220+
217221

218222
.. function:: getmodulename(path)
219223

@@ -405,6 +409,10 @@ Classes and functions
405409
default argument values or None if there are no default arguments; if this tuple
406410
has *n* elements, they correspond to the last *n* elements listed in *args*.
407411

412+
.. versionchanged:: 2.6
413+
Returns a :term:`named tuple` ``ArgSpec(args, varargs, keywords,
414+
defaults)``.
415+
408416

409417
.. function:: getargvalues(frame)
410418

@@ -414,6 +422,10 @@ Classes and functions
414422
names of the ``*`` and ``**`` arguments or ``None``. *locals* is the locals
415423
dictionary of the given frame.
416424

425+
.. versionchanged:: 2.6
426+
Returns a :term:`named tuple` ``ArgInfo(args, varargs, keywords,
427+
locals)``.
428+
417429

418430
.. function:: formatargspec(args[, varargs, varkw, defaults, formatarg, formatvarargs, formatvarkw, formatvalue, join])
419431

@@ -479,6 +491,10 @@ line.
479491
Get information about a frame or traceback object. A 5-tuple is returned, the
480492
last five elements of the frame's frame record.
481493

494+
.. versionchanged:: 2.6
495+
Returns a :term:`named tuple` ``Traceback(filename, lineno, function,
496+
code_context, index)``.
497+
482498

483499
.. function:: getouterframes(frame[, context])
484500

0 commit comments

Comments
 (0)