From 0cd467353285b493c9ec6f56e4ba055d580899b3 Mon Sep 17 00:00:00 2001
From: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Date: Thu, 4 May 2023 11:04:41 +0100
Subject: [PATCH] GH-97950: Use new-style index directive ('object')
(GH-104158)
* Uncomment object removal in pairindextypes
* Use new-style index directive ('object') - C API
* Use new-style index directive ('object') - Library
* Use new-style index directive ('object') - Reference
* Use new-style index directive ('object') - Tutorial
(cherry picked from commit 6ab463684b9d79880d98cd1f1406aa86af65985e)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
---
Doc/c-api/bytearray.rst | 2 +-
Doc/c-api/bytes.rst | 2 +-
Doc/c-api/capsule.rst | 2 +-
Doc/c-api/complex.rst | 2 +-
Doc/c-api/concrete.rst | 6 +-
Doc/c-api/dict.rst | 2 +-
Doc/c-api/file.rst | 2 +-
Doc/c-api/float.rst | 2 +-
Doc/c-api/function.rst | 2 +-
Doc/c-api/intro.rst | 2 +-
Doc/c-api/list.rst | 2 +-
Doc/c-api/long.rst | 4 +-
Doc/c-api/memoryview.rst | 2 +-
Doc/c-api/method.rst | 4 +-
Doc/c-api/module.rst | 2 +-
Doc/c-api/none.rst | 2 +-
Doc/c-api/set.rst | 4 +-
Doc/c-api/tuple.rst | 2 +-
Doc/c-api/type.rst | 2 +-
Doc/library/functions.rst | 2 +-
Doc/library/socket.rst | 2 +-
Doc/library/stdtypes.rst | 50 ++++++++---------
Doc/library/sys.rst | 2 +-
Doc/library/traceback.rst | 2 +-
Doc/reference/compound_stmts.rst | 10 ++--
Doc/reference/datamodel.rst | 88 +++++++++++++++---------------
Doc/reference/expressions.rst | 60 ++++++++++----------
Doc/reference/simple_stmts.rst | 16 +++---
Doc/tools/extensions/pyspecific.py | 2 +-
Doc/tutorial/classes.rst | 2 +-
Doc/tutorial/inputoutput.rst | 2 +-
31 files changed, 143 insertions(+), 143 deletions(-)
diff --git a/Doc/c-api/bytearray.rst b/Doc/c-api/bytearray.rst
index 4bf3cfe100cd01..456f7d89bca03c 100644
--- a/Doc/c-api/bytearray.rst
+++ b/Doc/c-api/bytearray.rst
@@ -5,7 +5,7 @@
Byte Array Objects
------------------
-.. index:: object: bytearray
+.. index:: pair: object; bytearray
.. c:type:: PyByteArrayObject
diff --git a/Doc/c-api/bytes.rst b/Doc/c-api/bytes.rst
index 7617487a462d37..21a5ab931c8bfb 100644
--- a/Doc/c-api/bytes.rst
+++ b/Doc/c-api/bytes.rst
@@ -8,7 +8,7 @@ Bytes Objects
These functions raise :exc:`TypeError` when expecting a bytes parameter and
called with a non-bytes parameter.
-.. index:: object: bytes
+.. index:: pair: object; bytes
.. c:type:: PyBytesObject
diff --git a/Doc/c-api/capsule.rst b/Doc/c-api/capsule.rst
index 1c8f432505ef68..427ed959c58568 100644
--- a/Doc/c-api/capsule.rst
+++ b/Doc/c-api/capsule.rst
@@ -5,7 +5,7 @@
Capsules
--------
-.. index:: object: Capsule
+.. index:: pair: object; Capsule
Refer to :ref:`using-capsules` for more information on using these objects.
diff --git a/Doc/c-api/complex.rst b/Doc/c-api/complex.rst
index 9228ce85200023..344da903da4c1a 100644
--- a/Doc/c-api/complex.rst
+++ b/Doc/c-api/complex.rst
@@ -5,7 +5,7 @@
Complex Number Objects
----------------------
-.. index:: object: complex number
+.. index:: pair: object; complex number
Python's complex number objects are implemented as two distinct types when
viewed from the C API: one is the Python object exposed to Python programs, and
diff --git a/Doc/c-api/concrete.rst b/Doc/c-api/concrete.rst
index 8d3124a12fa9d2..880f7b15ce68e8 100644
--- a/Doc/c-api/concrete.rst
+++ b/Doc/c-api/concrete.rst
@@ -40,7 +40,7 @@ This section describes Python type objects and the singleton object ``None``.
Numeric Objects
===============
-.. index:: object: numeric
+.. index:: pair: object; numeric
.. toctree::
@@ -55,7 +55,7 @@ Numeric Objects
Sequence Objects
================
-.. index:: object: sequence
+.. index:: pair: object; sequence
Generic operations on sequence objects were discussed in the previous chapter;
this section deals with the specific kinds of sequence objects that are
@@ -77,7 +77,7 @@ intrinsic to the Python language.
Container Objects
=================
-.. index:: object: mapping
+.. index:: pair: object; mapping
.. toctree::
diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst
index be7b5f1352433e..4bfd1d01590b8f 100644
--- a/Doc/c-api/dict.rst
+++ b/Doc/c-api/dict.rst
@@ -5,7 +5,7 @@
Dictionary Objects
------------------
-.. index:: object: dictionary
+.. index:: pair: object; dictionary
.. c:type:: PyDictObject
diff --git a/Doc/c-api/file.rst b/Doc/c-api/file.rst
index 58ed58e5466859..f32ecba9f27029 100644
--- a/Doc/c-api/file.rst
+++ b/Doc/c-api/file.rst
@@ -5,7 +5,7 @@
File Objects
------------
-.. index:: object: file
+.. index:: pair: object; file
These APIs are a minimal emulation of the Python 2 C API for built-in file
objects, which used to rely on the buffered I/O (:c:expr:`FILE*`) support
diff --git a/Doc/c-api/float.rst b/Doc/c-api/float.rst
index 023b12c20b7c83..05b2d100d575cb 100644
--- a/Doc/c-api/float.rst
+++ b/Doc/c-api/float.rst
@@ -5,7 +5,7 @@
Floating Point Objects
----------------------
-.. index:: object: floating point
+.. index:: pair: object; floating point
.. c:type:: PyFloatObject
diff --git a/Doc/c-api/function.rst b/Doc/c-api/function.rst
index 56c18396d3221d..1f28a685978b56 100644
--- a/Doc/c-api/function.rst
+++ b/Doc/c-api/function.rst
@@ -5,7 +5,7 @@
Function Objects
----------------
-.. index:: object: function
+.. index:: pair: object; function
There are a few functions specific to Python functions.
diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst
index bd37ed58ffdf70..17710b02abbc4e 100644
--- a/Doc/c-api/intro.rst
+++ b/Doc/c-api/intro.rst
@@ -261,7 +261,7 @@ complete listing.
Objects, Types and Reference Counts
===================================
-.. index:: object: type
+.. index:: pair: object; type
Most Python/C API functions have one or more arguments as well as a return value
of type :c:expr:`PyObject*`. This type is a pointer to an opaque data type
diff --git a/Doc/c-api/list.rst b/Doc/c-api/list.rst
index f9e65354a259f4..317421f0db8453 100644
--- a/Doc/c-api/list.rst
+++ b/Doc/c-api/list.rst
@@ -5,7 +5,7 @@
List Objects
------------
-.. index:: object: list
+.. index:: pair: object; list
.. c:type:: PyListObject
diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst
index b3e455d0a89c05..7b0d55dac8798b 100644
--- a/Doc/c-api/long.rst
+++ b/Doc/c-api/long.rst
@@ -5,8 +5,8 @@
Integer Objects
---------------
-.. index:: object: long integer
- object: integer
+.. index:: pair: object; long integer
+ pair: object; integer
All integers are implemented as "long" integer objects of arbitrary size.
diff --git a/Doc/c-api/memoryview.rst b/Doc/c-api/memoryview.rst
index ebd5c7760437bf..2aa43318e7a455 100644
--- a/Doc/c-api/memoryview.rst
+++ b/Doc/c-api/memoryview.rst
@@ -3,7 +3,7 @@
.. _memoryview-objects:
.. index::
- object: memoryview
+ pair: object; memoryview
MemoryView objects
------------------
diff --git a/Doc/c-api/method.rst b/Doc/c-api/method.rst
index 6e7e1e21aa93f2..93ad30cd4f7a8d 100644
--- a/Doc/c-api/method.rst
+++ b/Doc/c-api/method.rst
@@ -5,7 +5,7 @@
Instance Method Objects
-----------------------
-.. index:: object: instancemethod
+.. index:: pair: object; instancemethod
An instance method is a wrapper for a :c:data:`PyCFunction` and the new way
to bind a :c:data:`PyCFunction` to a class object. It replaces the former call
@@ -47,7 +47,7 @@ to bind a :c:data:`PyCFunction` to a class object. It replaces the former call
Method Objects
--------------
-.. index:: object: method
+.. index:: pair: object; method
Methods are bound function objects. Methods are always bound to an instance of
a user-defined class. Unbound methods (methods bound to a class object) are
diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst
index c0351c8a6c72aa..230b471d473be7 100644
--- a/Doc/c-api/module.rst
+++ b/Doc/c-api/module.rst
@@ -5,7 +5,7 @@
Module Objects
--------------
-.. index:: object: module
+.. index:: pair: object; module
.. c:var:: PyTypeObject PyModule_Type
diff --git a/Doc/c-api/none.rst b/Doc/c-api/none.rst
index 26d2b7aab201ba..b84a16a28ead56 100644
--- a/Doc/c-api/none.rst
+++ b/Doc/c-api/none.rst
@@ -5,7 +5,7 @@
The ``None`` Object
-------------------
-.. index:: object: None
+.. index:: pair: object; None
Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in the
Python/C API. Since ``None`` is a singleton, testing for object identity (using
diff --git a/Doc/c-api/set.rst b/Doc/c-api/set.rst
index f0d905bae8ae44..8e8af60252250e 100644
--- a/Doc/c-api/set.rst
+++ b/Doc/c-api/set.rst
@@ -9,8 +9,8 @@ Set Objects
.. index::
- object: set
- object: frozenset
+ pair: object; set
+ pair: object; frozenset
This section details the public API for :class:`set` and :class:`frozenset`
objects. Any functionality not listed below is best accessed using either
diff --git a/Doc/c-api/tuple.rst b/Doc/c-api/tuple.rst
index 0bfd4b308d9372..0982d29e48dec0 100644
--- a/Doc/c-api/tuple.rst
+++ b/Doc/c-api/tuple.rst
@@ -5,7 +5,7 @@
Tuple Objects
-------------
-.. index:: object: tuple
+.. index:: pair: object; tuple
.. c:type:: PyTupleObject
diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst
index ac352047798eb4..52eeef0a008639 100644
--- a/Doc/c-api/type.rst
+++ b/Doc/c-api/type.rst
@@ -5,7 +5,7 @@
Type Objects
------------
-.. index:: object: type
+.. index:: pair: object; type
.. c:type:: PyTypeObject
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 53294aa901a5b0..c5bdfc21e1839b 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1822,7 +1822,7 @@ are always available. They are listed here in alphabetical order.
.. class:: type(object)
type(name, bases, dict, **kwds)
- .. index:: object: type
+ .. index:: pair: object; type
With one argument, return the type of an *object*. The return value is a
type object and generally the same object as returned by
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index e222dc70e4220c..ab38b1d1da064d 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -19,7 +19,7 @@ all modern Unix systems, Windows, MacOS, and probably additional platforms.
.. include:: ../includes/wasm-notavail.rst
-.. index:: object: socket
+.. index:: pair: object; socket
The Python interface is a straightforward transliteration of the Unix system
call and library interface for sockets to Python's object-oriented style: the
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index b636adab60ddec..960959073c4bf5 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -205,11 +205,11 @@ Numeric Types --- :class:`int`, :class:`float`, :class:`complex`
================================================================
.. index::
- object: numeric
- object: Boolean
- object: integer
- object: floating point
- object: complex number
+ pair: object; numeric
+ pair: object; Boolean
+ pair: object; integer
+ pair: object; floating point
+ pair: object; complex number
pair: C; language
There are three distinct numeric types: :dfn:`integers`, :dfn:`floating
@@ -888,7 +888,7 @@ described in dedicated sections.
Common Sequence Operations
--------------------------
-.. index:: object: sequence
+.. index:: pair: object; sequence
The operations in the following table are supported by most sequence types,
both mutable and immutable. The :class:`collections.abc.Sequence` ABC is
@@ -1073,7 +1073,7 @@ Immutable Sequence Types
.. index::
triple: immutable; sequence; types
- object: tuple
+ pair: object; tuple
builtin: hash
The only operation that immutable sequence types generally implement that is
@@ -1095,8 +1095,8 @@ Mutable Sequence Types
.. index::
triple: mutable; sequence; types
- object: list
- object: bytearray
+ pair: object; list
+ pair: object; bytearray
The operations in the following table are defined on mutable sequence types.
The :class:`collections.abc.MutableSequence` ABC is provided to make it
@@ -1213,7 +1213,7 @@ Notes:
Lists
-----
-.. index:: object: list
+.. index:: pair: object; list
Lists are mutable sequences, typically used to store collections of
homogeneous items (where the precise degree of similarity will vary by
@@ -1292,7 +1292,7 @@ application).
Tuples
------
-.. index:: object: tuple
+.. index:: pair: object; tuple
Tuples are immutable sequences, typically used to store collections of
heterogeneous data (such as the 2-tuples produced by the :func:`enumerate`
@@ -1336,7 +1336,7 @@ choice than a simple tuple object.
Ranges
------
-.. index:: object: range
+.. index:: pair: object; range
The :class:`range` type represents an immutable sequence of numbers and is
commonly used for looping a specific number of times in :keyword:`for`
@@ -1461,7 +1461,7 @@ objects that compare equal might have different :attr:`~range.start`,
.. index::
single: string; text sequence type
single: str (built-in class); (see also string)
- object: string
+ pair: object; string
.. _textseq:
@@ -1495,7 +1495,7 @@ Since there is no separate "character" type, indexing a string produces
strings of length 1. That is, for a non-empty string *s*, ``s[0] == s[0:1]``.
.. index::
- object: io.StringIO
+ pair: object; io.StringIO
There is also no mutable string type, but :meth:`str.join` or
:class:`io.StringIO` can be used to efficiently construct strings from
@@ -2464,9 +2464,9 @@ Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:`memoryview
=================================================================================
.. index::
- object: bytes
- object: bytearray
- object: memoryview
+ pair: object; bytes
+ pair: object; bytearray
+ pair: object; memoryview
pair: module; array
The core built-in types for manipulating binary data are :class:`bytes` and
@@ -2482,7 +2482,7 @@ The :mod:`array` module supports efficient storage of basic data types like
Bytes Objects
-------------
-.. index:: object: bytes
+.. index:: pair: object; bytes
Bytes objects are immutable sequences of single bytes. Since many major
binary protocols are based on the ASCII text encoding, bytes objects offer
@@ -2589,7 +2589,7 @@ always convert a bytes object into a list of integers using ``list(b)``.
Bytearray Objects
-----------------
-.. index:: object: bytearray
+.. index:: pair: object; bytearray
:class:`bytearray` objects are a mutable counterpart to :class:`bytes`
objects.
@@ -4165,7 +4165,7 @@ copying.
Set Types --- :class:`set`, :class:`frozenset`
==============================================
-.. index:: object: set
+.. index:: pair: object; set
A :dfn:`set` object is an unordered collection of distinct :term:`hashable` objects.
Common uses include membership testing, removing duplicates from a sequence, and
@@ -4367,8 +4367,8 @@ Mapping Types --- :class:`dict`
===============================
.. index::
- object: mapping
- object: dictionary
+ pair: object; mapping
+ pair: object; dictionary
triple: operations on; mapping; types
triple: operations on; dictionary; type
statement: del
@@ -4836,7 +4836,7 @@ Generic Alias Type
------------------
.. index::
- object: GenericAlias
+ pair: object; GenericAlias
pair: Generic; Alias
``GenericAlias`` objects are generally created by
@@ -5091,7 +5091,7 @@ Union Type
----------
.. index::
- object: Union
+ pair: object; Union
pair: union; type
A union object holds the value of the ``|`` (bitwise or) operation on
@@ -5248,7 +5248,7 @@ See :ref:`function` for more information.
Methods
-------
-.. index:: object: method
+.. index:: pair: object; method
Methods are functions that are called using the attribute notation. There are
two flavors: built-in methods (such as :meth:`append` on lists) and class
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 6f90e6b42216d4..32713b2a8879d1 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -440,7 +440,7 @@ always available.
object ` which typically encapsulates the call
stack at the point where the exception last occurred.
- .. index:: object: traceback
+ .. index:: pair: object; traceback
If no exception is being handled anywhere on the stack, this function
return a tuple containing three ``None`` values.
diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst
index 053e97325e31d1..fd6a70cdfab10c 100644
--- a/Doc/library/traceback.rst
+++ b/Doc/library/traceback.rst
@@ -14,7 +14,7 @@ interpreter when it prints a stack trace. This is useful when you want to print
stack traces under program control, such as in a "wrapper" around the
interpreter.
-.. index:: object: traceback
+.. index:: pair: object; traceback
The module uses traceback objects --- these are objects of type :class:`types.TracebackType`,
which are assigned to the ``__traceback__`` field of :class:`BaseException` instances.
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index 3ed7239cd37460..4578e662ada693 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -147,7 +147,7 @@ The :keyword:`!for` statement
pair: keyword; else
pair: target; list
pair: loop; statement
- object: sequence
+ pair: object; sequence
single: : (colon); compound statement
The :keyword:`for` statement is used to iterate over the elements of a sequence
@@ -298,7 +298,7 @@ keeping all locals in that frame alive until the next garbage collection occurs.
.. index::
pair: module; sys
- object: traceback
+ pair: object; traceback
Before an :keyword:`!except` clause's suite is executed,
the exception is stored in the :mod:`sys` module, where it can be accessed
@@ -1196,8 +1196,8 @@ Function definitions
pair: function; definition
pair: function; name
pair: name; binding
- object: user-defined function
- object: function
+ pair: object; user-defined function
+ pair: object; function
pair: function; name
pair: name; binding
single: () (parentheses); function definition
@@ -1365,7 +1365,7 @@ Class definitions
=================
.. index::
- object: class
+ pair: object; class
statement: class
pair: class; definition
pair: class; name
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index e8117d982c2ae5..3f3a37dacc15f7 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -142,7 +142,7 @@ attributes.' These are attributes that provide access to the implementation and
are not intended for general use. Their definition may change in the future.
None
- .. index:: object: None
+ .. index:: pair: object; None
This type has a single value. There is a single object with this value. This
object is accessed through the built-in name ``None``. It is used to signify the
@@ -150,7 +150,7 @@ None
don't explicitly return anything. Its truth value is false.
NotImplemented
- .. index:: object: NotImplemented
+ .. index:: pair: object; NotImplemented
This type has a single value. There is a single object with this value. This
object is accessed through the built-in name ``NotImplemented``. Numeric methods
@@ -171,7 +171,7 @@ NotImplemented
Ellipsis
.. index::
- object: Ellipsis
+ pair: object; Ellipsis
single: ...; ellipsis literal
This type has a single value. There is a single object with this value. This
@@ -179,7 +179,7 @@ Ellipsis
``Ellipsis``. Its truth value is true.
:class:`numbers.Number`
- .. index:: object: numeric
+ .. index:: pair: object; numeric
These are created by numeric literals and returned as results by arithmetic
operators and arithmetic built-in functions. Numeric objects are immutable;
@@ -209,7 +209,7 @@ Ellipsis
numbers:
:class:`numbers.Integral`
- .. index:: object: integer
+ .. index:: pair: object; integer
These represent elements from the mathematical set of integers (positive and
negative).
@@ -225,7 +225,7 @@ Ellipsis
Booleans (:class:`bool`)
.. index::
- object: Boolean
+ pair: object; Boolean
single: False
single: True
@@ -242,7 +242,7 @@ Ellipsis
:class:`numbers.Real` (:class:`float`)
.. index::
- object: floating point
+ pair: object; floating point
pair: floating point; number
pair: C; language
pair: Java; language
@@ -257,7 +257,7 @@ Ellipsis
:class:`numbers.Complex` (:class:`complex`)
.. index::
- object: complex
+ pair: object; complex
pair: complex; number
These represent complex numbers as a pair of machine-level double precision
@@ -268,7 +268,7 @@ Ellipsis
Sequences
.. index::
builtin: len
- object: sequence
+ pair: object; sequence
single: index operation
single: item selection
single: subscription
@@ -293,8 +293,8 @@ Sequences
Immutable sequences
.. index::
- object: immutable sequence
- object: immutable
+ pair: object; immutable sequence
+ pair: object; immutable
An object of an immutable sequence type cannot change once it is created. (If
the object contains references to other objects, these other objects may be
@@ -328,7 +328,7 @@ Sequences
Tuples
.. index::
- object: tuple
+ pair: object; tuple
pair: singleton; tuple
pair: empty; tuple
@@ -350,8 +350,8 @@ Sequences
Mutable sequences
.. index::
- object: mutable sequence
- object: mutable
+ pair: object; mutable sequence
+ pair: object; mutable
pair: assignment; statement
single: subscription
single: slicing
@@ -363,7 +363,7 @@ Sequences
There are currently two intrinsic mutable sequence types:
Lists
- .. index:: object: list
+ .. index:: pair: object; list
The items of a list are arbitrary Python objects. Lists are formed by
placing a comma-separated list of expressions in square brackets. (Note
@@ -385,7 +385,7 @@ Sequences
Set types
.. index::
builtin: len
- object: set type
+ pair: object; set type
These represent unordered, finite sets of unique, immutable objects. As such,
they cannot be indexed by any subscript. However, they can be iterated over, and
@@ -402,14 +402,14 @@ Set types
There are currently two intrinsic set types:
Sets
- .. index:: object: set
+ .. index:: pair: object; set
These represent a mutable set. They are created by the built-in :func:`set`
constructor and can be modified afterwards by several methods, such as
:meth:`~set.add`.
Frozen sets
- .. index:: object: frozenset
+ .. index:: pair: object; frozenset
These represent an immutable set. They are created by the built-in
:func:`frozenset` constructor. As a frozenset is immutable and
@@ -420,7 +420,7 @@ Mappings
.. index::
builtin: len
single: subscription
- object: mapping
+ pair: object; mapping
These represent finite sets of objects indexed by arbitrary index sets. The
subscript notation ``a[k]`` selects the item indexed by ``k`` from the mapping
@@ -431,7 +431,7 @@ Mappings
There is currently a single intrinsic mapping type:
Dictionaries
- .. index:: object: dictionary
+ .. index:: pair: object; dictionary
These represent finite sets of objects indexed by nearly arbitrary values. The
only types of values not acceptable as keys are values containing lists or
@@ -465,7 +465,7 @@ Mappings
Callable types
.. index::
- object: callable
+ pair: object; callable
pair: function; call
single: invocation
pair: function; argument
@@ -476,8 +476,8 @@ Callable types
User-defined functions
.. index::
pair: user-defined; function
- object: function
- object: user-defined function
+ pair: object; function
+ pair: object; user-defined function
A user-defined function object is created by a function definition (see
section :ref:`function`). It should be called with an argument list
@@ -580,8 +580,8 @@ Callable types
Instance methods
.. index::
- object: method
- object: user-defined method
+ pair: object; method
+ pair: object; user-defined method
pair: user-defined; method
An instance method object combines a class, a class instance and any
@@ -688,8 +688,8 @@ Callable types
Built-in functions
.. index::
- object: built-in function
- object: function
+ pair: object; built-in function
+ pair: object; function
pair: C; language
A built-in function object is a wrapper around a C function. Examples of
@@ -703,8 +703,8 @@ Callable types
Built-in methods
.. index::
- object: built-in method
- object: method
+ pair: object; built-in method
+ pair: object; method
pair: built-in; method
This is really a different disguise of a built-in function, this time containing
@@ -728,7 +728,7 @@ Callable types
Modules
.. index::
statement: import
- object: module
+ pair: object; module
Modules are a basic organizational unit of Python code, and are created by
the :ref:`import system ` as invoked either by the
@@ -805,12 +805,12 @@ Custom classes
.. XXX: Could we add that MRO doc as an appendix to the language ref?
.. index::
- object: class
- object: class instance
- object: instance
+ pair: object; class
+ pair: object; class instance
+ pair: object; instance
pair: class object; call
single: container
- object: dictionary
+ pair: object; dictionary
pair: class; attribute
When a class attribute reference (for class :class:`C`, say) would yield a
@@ -865,8 +865,8 @@ Custom classes
Class instances
.. index::
- object: class instance
- object: instance
+ pair: object; class instance
+ pair: object; instance
pair: class; instance
pair: class instance; attribute
@@ -892,9 +892,9 @@ Class instances
dictionary directly.
.. index::
- object: numeric
- object: sequence
- object: mapping
+ pair: object; numeric
+ pair: object; sequence
+ pair: object; mapping
Class instances can pretend to be numbers, sequences, or mappings if they have
methods with certain special names. See section :ref:`specialnames`.
@@ -995,7 +995,7 @@ Internal types
required stack size; :attr:`co_flags` is an integer encoding a number
of flags for the interpreter.
- .. index:: object: generator
+ .. index:: pair: object; generator
The following flag bits are defined for :attr:`co_flags`: bit ``0x04`` is set if
the function uses the ``*arguments`` syntax to accept an arbitrary number of
@@ -1052,7 +1052,7 @@ Internal types
.. _frame-objects:
Frame objects
- .. index:: object: frame
+ .. index:: pair: object; frame
Frame objects represent execution frames. They may occur in traceback objects
(see below), and are also passed to registered trace functions.
@@ -1115,7 +1115,7 @@ Internal types
Traceback objects
.. index::
- object: traceback
+ pair: object; traceback
pair: stack; trace
pair: exception; handler
pair: execution; stack
@@ -1497,7 +1497,7 @@ Basic customization
.. method:: object.__hash__(self)
.. index::
- object: dictionary
+ pair: object; dictionary
builtin: hash
Called by built-in function :func:`hash` and for operations on members of
@@ -2501,7 +2501,7 @@ through the object's keys; for sequences, it should iterate through the values.
.. versionadded:: 3.4
-.. index:: object: slice
+.. index:: pair: object; slice
.. note::
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 46e8c7c0e5c625..ba0f8d87ba9eec 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -245,7 +245,7 @@ List displays
pair: list; display
pair: list; comprehensions
pair: empty; list
- object: list
+ pair: object; list
single: [] (square brackets); list expression
single: , (comma); expression list
@@ -270,7 +270,7 @@ Set displays
.. index::
pair: set; display
pair: set; comprehensions
- object: set
+ pair: object; set
single: {} (curly brackets); set expression
single: , (comma); expression list
@@ -299,7 +299,7 @@ Dictionary displays
pair: dictionary; display
pair: dictionary; comprehensions
key, datum, key/datum pair
- object: dictionary
+ pair: object; dictionary
single: {} (curly brackets); dictionary expression
single: : (colon); in dictionary expressions
single: , (comma); in dictionary displays
@@ -361,7 +361,7 @@ Generator expressions
.. index::
pair: generator; expression
- object: generator
+ pair: object; generator
single: () (parentheses); generator expression
A generator expression is a compact generator notation in parentheses:
@@ -522,7 +522,7 @@ on the right hand side of an assignment statement.
The proposal that expanded on :pep:`492` by adding generator capabilities to
coroutine functions.
-.. index:: object: generator
+.. index:: pair: object; generator
.. _generator-methods:
Generator-iterator methods
@@ -696,7 +696,7 @@ of a *finalizer* method see the implementation of
The expression ``yield from `` is a syntax error when used in an
asynchronous generator function.
-.. index:: object: asynchronous-generator
+.. index:: pair: object; asynchronous-generator
.. _asynchronous-generator-methods:
Asynchronous generator-iterator methods
@@ -800,8 +800,8 @@ An attribute reference is a primary followed by a period and a name:
.. index::
exception: AttributeError
- object: module
- object: list
+ pair: object; module
+ pair: object; list
The primary must evaluate to an object of a type that supports attribute
references, which most objects do. This object is then asked to produce the
@@ -822,12 +822,12 @@ Subscriptions
single: [] (square brackets); subscription
.. index::
- object: sequence
- object: mapping
- object: string
- object: tuple
- object: list
- object: dictionary
+ pair: object; sequence
+ pair: object; mapping
+ pair: object; string
+ pair: object; tuple
+ pair: object; list
+ pair: object; dictionary
pair: sequence; item
The subscription of an instance of a :ref:`container class `
@@ -895,10 +895,10 @@ Slicings
single: , (comma); slicing
.. index::
- object: sequence
- object: string
- object: tuple
- object: list
+ pair: object; sequence
+ pair: object; string
+ pair: object; tuple
+ pair: object; list
A slicing selects a range of items in a sequence object (e.g., a string, tuple
or list). Slicings may be used as expressions or as targets in assignment or
@@ -939,7 +939,7 @@ substituting ``None`` for missing expressions.
.. index::
- object: callable
+ pair: object; callable
single: call
single: argument; call semantics
single: () (parentheses); call
@@ -1089,8 +1089,8 @@ a user-defined function:
.. index::
pair: function; call
triple: user-defined; function; call
- object: user-defined function
- object: function
+ pair: object; user-defined function
+ pair: object; function
The code block for the function is executed, passing it the argument list. The
first thing the code block will do is bind the formal parameters to the
@@ -1104,25 +1104,25 @@ a built-in function or method:
pair: built-in function; call
pair: method; call
pair: built-in method; call
- object: built-in method
- object: built-in function
- object: method
- object: function
+ pair: object; built-in method
+ pair: object; built-in function
+ pair: object; method
+ pair: object; function
The result is up to the interpreter; see :ref:`built-in-funcs` for the
descriptions of built-in functions and methods.
a class object:
.. index::
- object: class
+ pair: object; class
pair: class object; call
A new instance of that class is returned.
a class instance method:
.. index::
- object: class instance
- object: instance
+ pair: object; class instance
+ pair: object; instance
pair: class instance; call
The corresponding user-defined function is called, with an argument list that is
@@ -1661,7 +1661,7 @@ if :keyword:`in` raised that exception).
pair: operator; in
pair: operator; not in
pair: membership; test
- object: sequence
+ pair: object; sequence
The operator :keyword:`not in` is defined to have the inverse truth value of
:keyword:`in`.
@@ -1843,7 +1843,7 @@ Expression lists
starred_expression: `expression` | (`starred_item` ",")* [`starred_item`]
starred_item: `assignment_expression` | "*" `or_expr`
-.. index:: object: tuple
+.. index:: pair: object; tuple
Except when part of a list or set display, an expression list
containing at least one comma yields a tuple. The length of
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst
index 5c7b5d7efaa2b5..acc3998e09be22 100644
--- a/Doc/reference/simple_stmts.rst
+++ b/Doc/reference/simple_stmts.rst
@@ -54,7 +54,7 @@ expression).
.. index::
builtin: repr
- object: None
+ pair: object; None
pair: string; conversion
single: output
pair: standard; output
@@ -76,7 +76,7 @@ Assignment statements
pair: assignment; statement
pair: binding; name
pair: rebinding; name
- object: mutable
+ pair: object; mutable
pair: attribute; assignment
Assignment statements are used to (re)bind names to values and to modify
@@ -185,7 +185,7 @@ Assignment of an object to a single target is recursively defined as follows.
.. index::
pair: subscription; assignment
- object: mutable
+ pair: object; mutable
* If the target is a subscription: The primary expression in the reference is
evaluated. It should yield either a mutable sequence object (such as a list)
@@ -193,8 +193,8 @@ Assignment of an object to a single target is recursively defined as follows.
evaluated.
.. index::
- object: sequence
- object: list
+ pair: object; sequence
+ pair: object; list
If the primary is a mutable sequence object (such as a list), the subscript
must yield an integer. If it is negative, the sequence's length is added to
@@ -204,8 +204,8 @@ Assignment of an object to a single target is recursively defined as follows.
raised (assignment to a subscripted sequence cannot add new items to a list).
.. index::
- object: mapping
- object: dictionary
+ pair: object; mapping
+ pair: object; dictionary
If the primary is a mapping object (such as a dictionary), the subscript must
have a type compatible with the mapping's key type, and the mapping is then
@@ -574,7 +574,7 @@ instantiating the class with no arguments.
The :dfn:`type` of the exception is the exception instance's class, the
:dfn:`value` is the instance itself.
-.. index:: object: traceback
+.. index:: pair: object; traceback
A traceback object is normally created automatically when an exception is raised
and attached to it as the :attr:`__traceback__` attribute, which is writable.
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index d6034e1bb71855..01c1c5cd77849b 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -697,7 +697,7 @@ def patch_pairindextypes(app) -> None:
pairindextypes.pop('module', None)
pairindextypes.pop('keyword', None)
pairindextypes.pop('operator', None)
- # pairindextypes.pop('object', None)
+ pairindextypes.pop('object', None)
# pairindextypes.pop('exception', None)
# pairindextypes.pop('statement', None)
# pairindextypes.pop('builtin', None)
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst
index 30450c70f3e8e9..db4ca92ae34227 100644
--- a/Doc/tutorial/classes.rst
+++ b/Doc/tutorial/classes.rst
@@ -344,7 +344,7 @@ list objects have methods called append, insert, remove, sort, and so on.
However, in the following discussion, we'll use the term method exclusively to
mean methods of class instance objects, unless explicitly stated otherwise.)
-.. index:: object: method
+.. index:: pair: object; method
Valid method names of an instance object depend on its class. By definition,
all attributes of a class that are function objects define corresponding
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index aeacc1559a228c..3fcf4e3f43a300 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -286,7 +286,7 @@ Reading and Writing Files
.. index::
builtin: open
- object: file
+ pair: object; file
:func:`open` returns a :term:`file object`, and is most commonly used with
two positional arguments and one keyword argument: