@@ -178,13 +178,14 @@ operators are only defined where they make sense; for example, they raise a
178
178
single: __ge__() (instance method)
179
179
180
180
Non-identical instances of a class normally compare as non-equal unless the
181
- class defines the :meth: `__eq__ ` method.
181
+ class defines the :meth: `~object. __eq__ ` method.
182
182
183
183
Instances of a class cannot be ordered with respect to other instances of the
184
184
same class, or other types of object, unless the class defines enough of the
185
- methods :meth: `__lt__ `, :meth: `__le__ `, :meth: `__gt__ `, and :meth: `__ge__ ` (in
186
- general, :meth: `__lt__ ` and :meth: `__eq__ ` are sufficient, if you want the
187
- conventional meanings of the comparison operators).
185
+ methods :meth: `~object.__lt__ `, :meth: `~object.__le__ `, :meth: `~object.__gt__ `, and
186
+ :meth: `~object.__ge__ ` (in general, :meth: `~object.__lt__ ` and
187
+ :meth: `~object.__eq__ ` are sufficient, if you want the conventional meanings of the
188
+ comparison operators).
188
189
189
190
The behavior of the :keyword: `is ` and :keyword: `is not ` operators cannot be
190
191
customized; also they can be applied to any two objects and never raise an
@@ -698,7 +699,7 @@ Hashing of numeric types
698
699
------------------------
699
700
700
701
For numbers ``x `` and ``y ``, possibly of different types, it's a requirement
701
- that ``hash(x) == hash(y) `` whenever ``x == y `` (see the :meth: `__hash__ `
702
+ that ``hash(x) == hash(y) `` whenever ``x == y `` (see the :meth: `~object. __hash__ `
702
703
method documentation for more details). For ease of implementation and
703
704
efficiency across a variety of numeric types (including :class: `int `,
704
705
:class: `float `, :class: `decimal.Decimal ` and :class: `fractions.Fraction `)
@@ -1334,7 +1335,7 @@ loops.
1334
1335
range(start, stop[, step])
1335
1336
1336
1337
The arguments to the range constructor must be integers (either built-in
1337
- :class: `int ` or any object that implements the `` __index__ ` ` special
1338
+ :class: `int ` or any object that implements the :meth: ` ~object. __index__ ` special
1338
1339
method). If the *step * argument is omitted, it defaults to ``1 ``.
1339
1340
If the *start * argument is omitted, it defaults to ``0 ``.
1340
1341
If *step * is zero, :exc: `ValueError ` is raised.
@@ -4793,9 +4794,9 @@ their implementation of the context management protocol. See the
4793
4794
Python's :term: `generator `\s and the :class: `contextlib.contextmanager ` decorator
4794
4795
provide a convenient way to implement these protocols. If a generator function is
4795
4796
decorated with the :class: `contextlib.contextmanager ` decorator, it will return a
4796
- context manager implementing the necessary :meth: `__enter__ ` and
4797
- :meth: `__exit__ ` methods, rather than the iterator produced by an undecorated
4798
- generator function.
4797
+ context manager implementing the necessary :meth: `~contextmanager. __enter__ ` and
4798
+ :meth: `~contextmanager. __exit__ ` methods, rather than the iterator produced by an
4799
+ undecorated generator function.
4799
4800
4800
4801
Note that there is no specific slot for any of these methods in the type
4801
4802
structure for Python objects in the Python/C API. Extension types wanting to
0 commit comments