GH-97950: Use new-style index directive ('object') (#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
This commit is contained in:
Adam Turner 2023-05-04 11:04:41 +01:00 committed by GitHub
parent b0ce2db118
commit 6ab463684b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 143 additions and 143 deletions

View File

@ -5,7 +5,7 @@
Byte Array Objects Byte Array Objects
------------------ ------------------
.. index:: object: bytearray .. index:: pair: object; bytearray
.. c:type:: PyByteArrayObject .. c:type:: PyByteArrayObject

View File

@ -8,7 +8,7 @@ Bytes Objects
These functions raise :exc:`TypeError` when expecting a bytes parameter and These functions raise :exc:`TypeError` when expecting a bytes parameter and
called with a non-bytes parameter. called with a non-bytes parameter.
.. index:: object: bytes .. index:: pair: object; bytes
.. c:type:: PyBytesObject .. c:type:: PyBytesObject

View File

@ -5,7 +5,7 @@
Capsules Capsules
-------- --------
.. index:: object: Capsule .. index:: pair: object; Capsule
Refer to :ref:`using-capsules` for more information on using these objects. Refer to :ref:`using-capsules` for more information on using these objects.

View File

@ -5,7 +5,7 @@
Complex Number Objects Complex Number Objects
---------------------- ----------------------
.. index:: object: complex number .. index:: pair: object; complex number
Python's complex number objects are implemented as two distinct types when 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 viewed from the C API: one is the Python object exposed to Python programs, and

View File

@ -40,7 +40,7 @@ This section describes Python type objects and the singleton object ``None``.
Numeric Objects Numeric Objects
=============== ===============
.. index:: object: numeric .. index:: pair: object; numeric
.. toctree:: .. toctree::
@ -55,7 +55,7 @@ Numeric Objects
Sequence Objects Sequence Objects
================ ================
.. index:: object: sequence .. index:: pair: object; sequence
Generic operations on sequence objects were discussed in the previous chapter; Generic operations on sequence objects were discussed in the previous chapter;
this section deals with the specific kinds of sequence objects that are this section deals with the specific kinds of sequence objects that are
@ -77,7 +77,7 @@ intrinsic to the Python language.
Container Objects Container Objects
================= =================
.. index:: object: mapping .. index:: pair: object; mapping
.. toctree:: .. toctree::

View File

@ -5,7 +5,7 @@
Dictionary Objects Dictionary Objects
------------------ ------------------
.. index:: object: dictionary .. index:: pair: object; dictionary
.. c:type:: PyDictObject .. c:type:: PyDictObject

View File

@ -5,7 +5,7 @@
File Objects 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 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 objects, which used to rely on the buffered I/O (:c:expr:`FILE*`) support

View File

@ -5,7 +5,7 @@
Floating Point Objects Floating Point Objects
---------------------- ----------------------
.. index:: object: floating point .. index:: pair: object; floating point
.. c:type:: PyFloatObject .. c:type:: PyFloatObject

View File

@ -5,7 +5,7 @@
Function Objects Function Objects
---------------- ----------------
.. index:: object: function .. index:: pair: object; function
There are a few functions specific to Python functions. There are a few functions specific to Python functions.

View File

@ -261,7 +261,7 @@ complete listing.
Objects, Types and Reference Counts 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 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 of type :c:expr:`PyObject*`. This type is a pointer to an opaque data type

View File

@ -5,7 +5,7 @@
List Objects List Objects
------------ ------------
.. index:: object: list .. index:: pair: object; list
.. c:type:: PyListObject .. c:type:: PyListObject

View File

@ -5,8 +5,8 @@
Integer Objects Integer Objects
--------------- ---------------
.. index:: object: long integer .. index:: pair: object; long integer
object: integer pair: object; integer
All integers are implemented as "long" integer objects of arbitrary size. All integers are implemented as "long" integer objects of arbitrary size.

View File

@ -3,7 +3,7 @@
.. _memoryview-objects: .. _memoryview-objects:
.. index:: .. index::
object: memoryview pair: object; memoryview
MemoryView objects MemoryView objects
------------------ ------------------

View File

@ -5,7 +5,7 @@
Instance Method Objects 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 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 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 Method Objects
-------------- --------------
.. index:: object: method .. index:: pair: object; method
Methods are bound function objects. Methods are always bound to an instance of 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 a user-defined class. Unbound methods (methods bound to a class object) are

View File

@ -5,7 +5,7 @@
Module Objects Module Objects
-------------- --------------
.. index:: object: module .. index:: pair: object; module
.. c:var:: PyTypeObject PyModule_Type .. c:var:: PyTypeObject PyModule_Type

View File

@ -5,7 +5,7 @@
The ``None`` Object The ``None`` Object
------------------- -------------------
.. index:: object: None .. index:: pair: object; None
Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in the 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 Python/C API. Since ``None`` is a singleton, testing for object identity (using

View File

@ -9,8 +9,8 @@ Set Objects
.. index:: .. index::
object: set pair: object; set
object: frozenset pair: object; frozenset
This section details the public API for :class:`set` and :class:`frozenset` This section details the public API for :class:`set` and :class:`frozenset`
objects. Any functionality not listed below is best accessed using either objects. Any functionality not listed below is best accessed using either

View File

@ -5,7 +5,7 @@
Tuple Objects Tuple Objects
------------- -------------
.. index:: object: tuple .. index:: pair: object; tuple
.. c:type:: PyTupleObject .. c:type:: PyTupleObject

View File

@ -5,7 +5,7 @@
Type Objects Type Objects
------------ ------------
.. index:: object: type .. index:: pair: object; type
.. c:type:: PyTypeObject .. c:type:: PyTypeObject

View File

@ -1830,7 +1830,7 @@ are always available. They are listed here in alphabetical order.
.. class:: type(object) .. class:: type(object)
type(name, bases, dict, **kwds) 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 With one argument, return the type of an *object*. The return value is a
type object and generally the same object as returned by type object and generally the same object as returned by

View File

@ -19,7 +19,7 @@ all modern Unix systems, Windows, MacOS, and probably additional platforms.
.. include:: ../includes/wasm-notavail.rst .. include:: ../includes/wasm-notavail.rst
.. index:: object: socket .. index:: pair: object; socket
The Python interface is a straightforward transliteration of the Unix system The Python interface is a straightforward transliteration of the Unix system
call and library interface for sockets to Python's object-oriented style: the call and library interface for sockets to Python's object-oriented style: the

View File

@ -205,11 +205,11 @@ Numeric Types --- :class:`int`, :class:`float`, :class:`complex`
================================================================ ================================================================
.. index:: .. index::
object: numeric pair: object; numeric
object: Boolean pair: object; Boolean
object: integer pair: object; integer
object: floating point pair: object; floating point
object: complex number pair: object; complex number
pair: C; language pair: C; language
There are three distinct numeric types: :dfn:`integers`, :dfn:`floating There are three distinct numeric types: :dfn:`integers`, :dfn:`floating
@ -927,7 +927,7 @@ described in dedicated sections.
Common Sequence Operations Common Sequence Operations
-------------------------- --------------------------
.. index:: object: sequence .. index:: pair: object; sequence
The operations in the following table are supported by most sequence types, The operations in the following table are supported by most sequence types,
both mutable and immutable. The :class:`collections.abc.Sequence` ABC is both mutable and immutable. The :class:`collections.abc.Sequence` ABC is
@ -1112,7 +1112,7 @@ Immutable Sequence Types
.. index:: .. index::
triple: immutable; sequence; types triple: immutable; sequence; types
object: tuple pair: object; tuple
builtin: hash builtin: hash
The only operation that immutable sequence types generally implement that is The only operation that immutable sequence types generally implement that is
@ -1134,8 +1134,8 @@ Mutable Sequence Types
.. index:: .. index::
triple: mutable; sequence; types triple: mutable; sequence; types
object: list pair: object; list
object: bytearray pair: object; bytearray
The operations in the following table are defined on mutable sequence types. The operations in the following table are defined on mutable sequence types.
The :class:`collections.abc.MutableSequence` ABC is provided to make it The :class:`collections.abc.MutableSequence` ABC is provided to make it
@ -1252,7 +1252,7 @@ Notes:
Lists Lists
----- -----
.. index:: object: list .. index:: pair: object; list
Lists are mutable sequences, typically used to store collections of Lists are mutable sequences, typically used to store collections of
homogeneous items (where the precise degree of similarity will vary by homogeneous items (where the precise degree of similarity will vary by
@ -1331,7 +1331,7 @@ application).
Tuples Tuples
------ ------
.. index:: object: tuple .. index:: pair: object; tuple
Tuples are immutable sequences, typically used to store collections of Tuples are immutable sequences, typically used to store collections of
heterogeneous data (such as the 2-tuples produced by the :func:`enumerate` heterogeneous data (such as the 2-tuples produced by the :func:`enumerate`
@ -1375,7 +1375,7 @@ choice than a simple tuple object.
Ranges Ranges
------ ------
.. index:: object: range .. index:: pair: object; range
The :class:`range` type represents an immutable sequence of numbers and is The :class:`range` type represents an immutable sequence of numbers and is
commonly used for looping a specific number of times in :keyword:`for` commonly used for looping a specific number of times in :keyword:`for`
@ -1500,7 +1500,7 @@ objects that compare equal might have different :attr:`~range.start`,
.. index:: .. index::
single: string; text sequence type single: string; text sequence type
single: str (built-in class); (see also string) single: str (built-in class); (see also string)
object: string pair: object; string
.. _textseq: .. _textseq:
@ -1534,7 +1534,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]``. strings of length 1. That is, for a non-empty string *s*, ``s[0] == s[0:1]``.
.. index:: .. index::
object: io.StringIO pair: object; io.StringIO
There is also no mutable string type, but :meth:`str.join` or There is also no mutable string type, but :meth:`str.join` or
:class:`io.StringIO` can be used to efficiently construct strings from :class:`io.StringIO` can be used to efficiently construct strings from
@ -2508,9 +2508,9 @@ Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:`memoryview
================================================================================= =================================================================================
.. index:: .. index::
object: bytes pair: object; bytes
object: bytearray pair: object; bytearray
object: memoryview pair: object; memoryview
pair: module; array pair: module; array
The core built-in types for manipulating binary data are :class:`bytes` and The core built-in types for manipulating binary data are :class:`bytes` and
@ -2526,7 +2526,7 @@ The :mod:`array` module supports efficient storage of basic data types like
Bytes Objects Bytes Objects
------------- -------------
.. index:: object: bytes .. index:: pair: object; bytes
Bytes objects are immutable sequences of single bytes. Since many major Bytes objects are immutable sequences of single bytes. Since many major
binary protocols are based on the ASCII text encoding, bytes objects offer binary protocols are based on the ASCII text encoding, bytes objects offer
@ -2633,7 +2633,7 @@ always convert a bytes object into a list of integers using ``list(b)``.
Bytearray Objects Bytearray Objects
----------------- -----------------
.. index:: object: bytearray .. index:: pair: object; bytearray
:class:`bytearray` objects are a mutable counterpart to :class:`bytes` :class:`bytearray` objects are a mutable counterpart to :class:`bytes`
objects. objects.
@ -4212,7 +4212,7 @@ copying.
Set Types --- :class:`set`, :class:`frozenset` 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. A :dfn:`set` object is an unordered collection of distinct :term:`hashable` objects.
Common uses include membership testing, removing duplicates from a sequence, and Common uses include membership testing, removing duplicates from a sequence, and
@ -4414,8 +4414,8 @@ Mapping Types --- :class:`dict`
=============================== ===============================
.. index:: .. index::
object: mapping pair: object; mapping
object: dictionary pair: object; dictionary
triple: operations on; mapping; types triple: operations on; mapping; types
triple: operations on; dictionary; type triple: operations on; dictionary; type
statement: del statement: del
@ -4889,7 +4889,7 @@ Generic Alias Type
------------------ ------------------
.. index:: .. index::
object: GenericAlias pair: object; GenericAlias
pair: Generic; Alias pair: Generic; Alias
``GenericAlias`` objects are generally created by ``GenericAlias`` objects are generally created by
@ -5144,7 +5144,7 @@ Union Type
---------- ----------
.. index:: .. index::
object: Union pair: object; Union
pair: union; type pair: union; type
A union object holds the value of the ``|`` (bitwise or) operation on A union object holds the value of the ``|`` (bitwise or) operation on
@ -5301,7 +5301,7 @@ See :ref:`function` for more information.
Methods Methods
------- -------
.. index:: object: method .. index:: pair: object; method
Methods are functions that are called using the attribute notation. There are 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 two flavors: built-in methods (such as :meth:`append` on lists) and class

View File

@ -444,7 +444,7 @@ always available.
object <traceback-objects>` which typically encapsulates the call object <traceback-objects>` which typically encapsulates the call
stack at the point where the exception last occurred. 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 If no exception is being handled anywhere on the stack, this function
return a tuple containing three ``None`` values. return a tuple containing three ``None`` values.

View File

@ -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 stack traces under program control, such as in a "wrapper" around the
interpreter. interpreter.
.. index:: object: traceback .. index:: pair: object; traceback
The module uses traceback objects --- these are objects of type :class:`types.TracebackType`, The module uses traceback objects --- these are objects of type :class:`types.TracebackType`,
which are assigned to the ``__traceback__`` field of :class:`BaseException` instances. which are assigned to the ``__traceback__`` field of :class:`BaseException` instances.

View File

@ -147,7 +147,7 @@ The :keyword:`!for` statement
pair: keyword; else pair: keyword; else
pair: target; list pair: target; list
pair: loop; statement pair: loop; statement
object: sequence pair: object; sequence
single: : (colon); compound statement single: : (colon); compound statement
The :keyword:`for` statement is used to iterate over the elements of a sequence 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:: .. index::
pair: module; sys pair: module; sys
object: traceback pair: object; traceback
Before an :keyword:`!except` clause's suite is executed, Before an :keyword:`!except` clause's suite is executed,
the exception is stored in the :mod:`sys` module, where it can be accessed the exception is stored in the :mod:`sys` module, where it can be accessed
@ -1194,8 +1194,8 @@ Function definitions
pair: function; definition pair: function; definition
pair: function; name pair: function; name
pair: name; binding pair: name; binding
object: user-defined function pair: object; user-defined function
object: function pair: object; function
pair: function; name pair: function; name
pair: name; binding pair: name; binding
single: () (parentheses); function definition single: () (parentheses); function definition
@ -1363,7 +1363,7 @@ Class definitions
================= =================
.. index:: .. index::
object: class pair: object; class
statement: class statement: class
pair: class; definition pair: class; definition
pair: class; name pair: class; name

View File

@ -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. are not intended for general use. Their definition may change in the future.
None None
.. index:: object: None .. index:: pair: object; None
This type has a single value. There is a single object with this value. This 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 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. don't explicitly return anything. Its truth value is false.
NotImplemented NotImplemented
.. index:: object: NotImplemented .. index:: pair: object; NotImplemented
This type has a single value. There is a single object with this value. This 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 object is accessed through the built-in name ``NotImplemented``. Numeric methods
@ -171,7 +171,7 @@ NotImplemented
Ellipsis Ellipsis
.. index:: .. index::
object: Ellipsis pair: object; Ellipsis
single: ...; ellipsis literal single: ...; ellipsis literal
This type has a single value. There is a single object with this value. This 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. ``Ellipsis``. Its truth value is true.
:class:`numbers.Number` :class:`numbers.Number`
.. index:: object: numeric .. index:: pair: object; numeric
These are created by numeric literals and returned as results by arithmetic These are created by numeric literals and returned as results by arithmetic
operators and arithmetic built-in functions. Numeric objects are immutable; operators and arithmetic built-in functions. Numeric objects are immutable;
@ -209,7 +209,7 @@ Ellipsis
numbers: numbers:
:class:`numbers.Integral` :class:`numbers.Integral`
.. index:: object: integer .. index:: pair: object; integer
These represent elements from the mathematical set of integers (positive and These represent elements from the mathematical set of integers (positive and
negative). negative).
@ -225,7 +225,7 @@ Ellipsis
Booleans (:class:`bool`) Booleans (:class:`bool`)
.. index:: .. index::
object: Boolean pair: object; Boolean
single: False single: False
single: True single: True
@ -242,7 +242,7 @@ Ellipsis
:class:`numbers.Real` (:class:`float`) :class:`numbers.Real` (:class:`float`)
.. index:: .. index::
object: floating point pair: object; floating point
pair: floating point; number pair: floating point; number
pair: C; language pair: C; language
pair: Java; language pair: Java; language
@ -257,7 +257,7 @@ Ellipsis
:class:`numbers.Complex` (:class:`complex`) :class:`numbers.Complex` (:class:`complex`)
.. index:: .. index::
object: complex pair: object; complex
pair: complex; number pair: complex; number
These represent complex numbers as a pair of machine-level double precision These represent complex numbers as a pair of machine-level double precision
@ -268,7 +268,7 @@ Ellipsis
Sequences Sequences
.. index:: .. index::
builtin: len builtin: len
object: sequence pair: object; sequence
single: index operation single: index operation
single: item selection single: item selection
single: subscription single: subscription
@ -293,8 +293,8 @@ Sequences
Immutable sequences Immutable sequences
.. index:: .. index::
object: immutable sequence pair: object; immutable sequence
object: immutable pair: object; immutable
An object of an immutable sequence type cannot change once it is created. (If 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 the object contains references to other objects, these other objects may be
@ -328,7 +328,7 @@ Sequences
Tuples Tuples
.. index:: .. index::
object: tuple pair: object; tuple
pair: singleton; tuple pair: singleton; tuple
pair: empty; tuple pair: empty; tuple
@ -350,8 +350,8 @@ Sequences
Mutable sequences Mutable sequences
.. index:: .. index::
object: mutable sequence pair: object; mutable sequence
object: mutable pair: object; mutable
pair: assignment; statement pair: assignment; statement
single: subscription single: subscription
single: slicing single: slicing
@ -363,7 +363,7 @@ Sequences
There are currently two intrinsic mutable sequence types: There are currently two intrinsic mutable sequence types:
Lists Lists
.. index:: object: list .. index:: pair: object; list
The items of a list are arbitrary Python objects. Lists are formed by The items of a list are arbitrary Python objects. Lists are formed by
placing a comma-separated list of expressions in square brackets. (Note placing a comma-separated list of expressions in square brackets. (Note
@ -385,7 +385,7 @@ Sequences
Set types Set types
.. index:: .. index::
builtin: len builtin: len
object: set type pair: object; set type
These represent unordered, finite sets of unique, immutable objects. As such, 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 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: There are currently two intrinsic set types:
Sets Sets
.. index:: object: set .. index:: pair: object; set
These represent a mutable set. They are created by the built-in :func:`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 constructor and can be modified afterwards by several methods, such as
:meth:`~set.add`. :meth:`~set.add`.
Frozen sets Frozen sets
.. index:: object: frozenset .. index:: pair: object; frozenset
These represent an immutable set. They are created by the built-in These represent an immutable set. They are created by the built-in
:func:`frozenset` constructor. As a frozenset is immutable and :func:`frozenset` constructor. As a frozenset is immutable and
@ -420,7 +420,7 @@ Mappings
.. index:: .. index::
builtin: len builtin: len
single: subscription single: subscription
object: mapping pair: object; mapping
These represent finite sets of objects indexed by arbitrary index sets. The 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 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: There is currently a single intrinsic mapping type:
Dictionaries Dictionaries
.. index:: object: dictionary .. index:: pair: object; dictionary
These represent finite sets of objects indexed by nearly arbitrary values. The 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 only types of values not acceptable as keys are values containing lists or
@ -465,7 +465,7 @@ Mappings
Callable types Callable types
.. index:: .. index::
object: callable pair: object; callable
pair: function; call pair: function; call
single: invocation single: invocation
pair: function; argument pair: function; argument
@ -476,8 +476,8 @@ Callable types
User-defined functions User-defined functions
.. index:: .. index::
pair: user-defined; function pair: user-defined; function
object: function pair: object; function
object: user-defined function pair: object; user-defined function
A user-defined function object is created by a function definition (see A user-defined function object is created by a function definition (see
section :ref:`function`). It should be called with an argument list section :ref:`function`). It should be called with an argument list
@ -580,8 +580,8 @@ Callable types
Instance methods Instance methods
.. index:: .. index::
object: method pair: object; method
object: user-defined method pair: object; user-defined method
pair: user-defined; method pair: user-defined; method
An instance method object combines a class, a class instance and any An instance method object combines a class, a class instance and any
@ -688,8 +688,8 @@ Callable types
Built-in functions Built-in functions
.. index:: .. index::
object: built-in function pair: object; built-in function
object: function pair: object; function
pair: C; language pair: C; language
A built-in function object is a wrapper around a C function. Examples of A built-in function object is a wrapper around a C function. Examples of
@ -703,8 +703,8 @@ Callable types
Built-in methods Built-in methods
.. index:: .. index::
object: built-in method pair: object; built-in method
object: method pair: object; method
pair: built-in; method pair: built-in; method
This is really a different disguise of a built-in function, this time containing This is really a different disguise of a built-in function, this time containing
@ -728,7 +728,7 @@ Callable types
Modules Modules
.. index:: .. index::
statement: import statement: import
object: module pair: object; module
Modules are a basic organizational unit of Python code, and are created by Modules are a basic organizational unit of Python code, and are created by
the :ref:`import system <importsystem>` as invoked either by the the :ref:`import system <importsystem>` 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? .. XXX: Could we add that MRO doc as an appendix to the language ref?
.. index:: .. index::
object: class pair: object; class
object: class instance pair: object; class instance
object: instance pair: object; instance
pair: class object; call pair: class object; call
single: container single: container
object: dictionary pair: object; dictionary
pair: class; attribute pair: class; attribute
When a class attribute reference (for class :class:`C`, say) would yield a When a class attribute reference (for class :class:`C`, say) would yield a
@ -865,8 +865,8 @@ Custom classes
Class instances Class instances
.. index:: .. index::
object: class instance pair: object; class instance
object: instance pair: object; instance
pair: class; instance pair: class; instance
pair: class instance; attribute pair: class instance; attribute
@ -892,9 +892,9 @@ Class instances
dictionary directly. dictionary directly.
.. index:: .. index::
object: numeric pair: object; numeric
object: sequence pair: object; sequence
object: mapping pair: object; mapping
Class instances can pretend to be numbers, sequences, or mappings if they have Class instances can pretend to be numbers, sequences, or mappings if they have
methods with certain special names. See section :ref:`specialnames`. methods with certain special names. See section :ref:`specialnames`.
@ -996,7 +996,7 @@ Internal types
required stack size; :attr:`co_flags` is an integer encoding a number required stack size; :attr:`co_flags` is an integer encoding a number
of flags for the interpreter. 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 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 the function uses the ``*arguments`` syntax to accept an arbitrary number of
@ -1053,7 +1053,7 @@ Internal types
.. _frame-objects: .. _frame-objects:
Frame objects Frame objects
.. index:: object: frame .. index:: pair: object; frame
Frame objects represent execution frames. They may occur in traceback objects Frame objects represent execution frames. They may occur in traceback objects
(see below), and are also passed to registered trace functions. (see below), and are also passed to registered trace functions.
@ -1116,7 +1116,7 @@ Internal types
Traceback objects Traceback objects
.. index:: .. index::
object: traceback pair: object; traceback
pair: stack; trace pair: stack; trace
pair: exception; handler pair: exception; handler
pair: execution; stack pair: execution; stack
@ -1498,7 +1498,7 @@ Basic customization
.. method:: object.__hash__(self) .. method:: object.__hash__(self)
.. index:: .. index::
object: dictionary pair: object; dictionary
builtin: hash builtin: hash
Called by built-in function :func:`hash` and for operations on members of Called by built-in function :func:`hash` and for operations on members of
@ -2506,7 +2506,7 @@ through the object's keys; for sequences, it should iterate through the values.
.. versionadded:: 3.4 .. versionadded:: 3.4
.. index:: object: slice .. index:: pair: object; slice
.. note:: .. note::

View File

@ -245,7 +245,7 @@ List displays
pair: list; display pair: list; display
pair: list; comprehensions pair: list; comprehensions
pair: empty; list pair: empty; list
object: list pair: object; list
single: [] (square brackets); list expression single: [] (square brackets); list expression
single: , (comma); expression list single: , (comma); expression list
@ -270,7 +270,7 @@ Set displays
.. index:: .. index::
pair: set; display pair: set; display
pair: set; comprehensions pair: set; comprehensions
object: set pair: object; set
single: {} (curly brackets); set expression single: {} (curly brackets); set expression
single: , (comma); expression list single: , (comma); expression list
@ -299,7 +299,7 @@ Dictionary displays
pair: dictionary; display pair: dictionary; display
pair: dictionary; comprehensions pair: dictionary; comprehensions
key, datum, key/datum pair key, datum, key/datum pair
object: dictionary pair: object; dictionary
single: {} (curly brackets); dictionary expression single: {} (curly brackets); dictionary expression
single: : (colon); in dictionary expressions single: : (colon); in dictionary expressions
single: , (comma); in dictionary displays single: , (comma); in dictionary displays
@ -361,7 +361,7 @@ Generator expressions
.. index:: .. index::
pair: generator; expression pair: generator; expression
object: generator pair: object; generator
single: () (parentheses); generator expression single: () (parentheses); generator expression
A generator expression is a compact generator notation in parentheses: 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 The proposal that expanded on :pep:`492` by adding generator capabilities to
coroutine functions. coroutine functions.
.. index:: object: generator .. index:: pair: object; generator
.. _generator-methods: .. _generator-methods:
Generator-iterator methods Generator-iterator methods
@ -701,7 +701,7 @@ of a *finalizer* method see the implementation of
The expression ``yield from <expr>`` is a syntax error when used in an The expression ``yield from <expr>`` is a syntax error when used in an
asynchronous generator function. asynchronous generator function.
.. index:: object: asynchronous-generator .. index:: pair: object; asynchronous-generator
.. _asynchronous-generator-methods: .. _asynchronous-generator-methods:
Asynchronous generator-iterator methods Asynchronous generator-iterator methods
@ -811,8 +811,8 @@ An attribute reference is a primary followed by a period and a name:
.. index:: .. index::
exception: AttributeError exception: AttributeError
object: module pair: object; module
object: list pair: object; list
The primary must evaluate to an object of a type that supports attribute 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 references, which most objects do. This object is then asked to produce the
@ -833,12 +833,12 @@ Subscriptions
single: [] (square brackets); subscription single: [] (square brackets); subscription
.. index:: .. index::
object: sequence pair: object; sequence
object: mapping pair: object; mapping
object: string pair: object; string
object: tuple pair: object; tuple
object: list pair: object; list
object: dictionary pair: object; dictionary
pair: sequence; item pair: sequence; item
The subscription of an instance of a :ref:`container class <sequence-types>` The subscription of an instance of a :ref:`container class <sequence-types>`
@ -906,10 +906,10 @@ Slicings
single: , (comma); slicing single: , (comma); slicing
.. index:: .. index::
object: sequence pair: object; sequence
object: string pair: object; string
object: tuple pair: object; tuple
object: list pair: object; list
A slicing selects a range of items in a sequence object (e.g., a string, tuple 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 or list). Slicings may be used as expressions or as targets in assignment or
@ -950,7 +950,7 @@ substituting ``None`` for missing expressions.
.. index:: .. index::
object: callable pair: object; callable
single: call single: call
single: argument; call semantics single: argument; call semantics
single: () (parentheses); call single: () (parentheses); call
@ -1100,8 +1100,8 @@ a user-defined function:
.. index:: .. index::
pair: function; call pair: function; call
triple: user-defined; function; call triple: user-defined; function; call
object: user-defined function pair: object; user-defined function
object: function pair: object; function
The code block for the function is executed, passing it the argument list. The 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 first thing the code block will do is bind the formal parameters to the
@ -1115,25 +1115,25 @@ a built-in function or method:
pair: built-in function; call pair: built-in function; call
pair: method; call pair: method; call
pair: built-in method; call pair: built-in method; call
object: built-in method pair: object; built-in method
object: built-in function pair: object; built-in function
object: method pair: object; method
object: function pair: object; function
The result is up to the interpreter; see :ref:`built-in-funcs` for the The result is up to the interpreter; see :ref:`built-in-funcs` for the
descriptions of built-in functions and methods. descriptions of built-in functions and methods.
a class object: a class object:
.. index:: .. index::
object: class pair: object; class
pair: class object; call pair: class object; call
A new instance of that class is returned. A new instance of that class is returned.
a class instance method: a class instance method:
.. index:: .. index::
object: class instance pair: object; class instance
object: instance pair: object; instance
pair: class instance; call pair: class instance; call
The corresponding user-defined function is called, with an argument list that is The corresponding user-defined function is called, with an argument list that is
@ -1672,7 +1672,7 @@ if :keyword:`in` raised that exception).
pair: operator; in pair: operator; in
pair: operator; not in pair: operator; not in
pair: membership; test pair: membership; test
object: sequence pair: object; sequence
The operator :keyword:`not in` is defined to have the inverse truth value of The operator :keyword:`not in` is defined to have the inverse truth value of
:keyword:`in`. :keyword:`in`.
@ -1854,7 +1854,7 @@ Expression lists
starred_expression: `expression` | (`starred_item` ",")* [`starred_item`] starred_expression: `expression` | (`starred_item` ",")* [`starred_item`]
starred_item: `assignment_expression` | "*" `or_expr` 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 Except when part of a list or set display, an expression list
containing at least one comma yields a tuple. The length of containing at least one comma yields a tuple. The length of

View File

@ -54,7 +54,7 @@ expression).
.. index:: .. index::
builtin: repr builtin: repr
object: None pair: object; None
pair: string; conversion pair: string; conversion
single: output single: output
pair: standard; output pair: standard; output
@ -76,7 +76,7 @@ Assignment statements
pair: assignment; statement pair: assignment; statement
pair: binding; name pair: binding; name
pair: rebinding; name pair: rebinding; name
object: mutable pair: object; mutable
pair: attribute; assignment pair: attribute; assignment
Assignment statements are used to (re)bind names to values and to modify 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:: .. index::
pair: subscription; assignment pair: subscription; assignment
object: mutable pair: object; mutable
* If the target is a subscription: The primary expression in the reference is * 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) 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. evaluated.
.. index:: .. index::
object: sequence pair: object; sequence
object: list pair: object; list
If the primary is a mutable sequence object (such as a list), the subscript 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 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). raised (assignment to a subscripted sequence cannot add new items to a list).
.. index:: .. index::
object: mapping pair: object; mapping
object: dictionary pair: object; dictionary
If the primary is a mapping object (such as a dictionary), the subscript must 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 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 The :dfn:`type` of the exception is the exception instance's class, the
:dfn:`value` is the instance itself. :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 A traceback object is normally created automatically when an exception is raised
and attached to it as the :attr:`__traceback__` attribute, which is writable. and attached to it as the :attr:`__traceback__` attribute, which is writable.

View File

@ -692,7 +692,7 @@ def patch_pairindextypes(app) -> None:
pairindextypes.pop('module', None) pairindextypes.pop('module', None)
pairindextypes.pop('keyword', None) pairindextypes.pop('keyword', None)
pairindextypes.pop('operator', None) pairindextypes.pop('operator', None)
# pairindextypes.pop('object', None) pairindextypes.pop('object', None)
# pairindextypes.pop('exception', None) # pairindextypes.pop('exception', None)
# pairindextypes.pop('statement', None) # pairindextypes.pop('statement', None)
# pairindextypes.pop('builtin', None) # pairindextypes.pop('builtin', None)

View File

@ -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 However, in the following discussion, we'll use the term method exclusively to
mean methods of class instance objects, unless explicitly stated otherwise.) 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, Valid method names of an instance object depend on its class. By definition,
all attributes of a class that are function objects define corresponding all attributes of a class that are function objects define corresponding

View File

@ -286,7 +286,7 @@ Reading and Writing Files
.. index:: .. index::
builtin: open builtin: open
object: file pair: object; file
:func:`open` returns a :term:`file object`, and is most commonly used with :func:`open` returns a :term:`file object`, and is most commonly used with
two positional arguments and one keyword argument: two positional arguments and one keyword argument: