mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
bpo-30085: Improve documentation for operator (#1171)
The dunderless functions are preferred; dunder are retained for back compatilibity. Patch by Sanket Dasgupta.
This commit is contained in:
parent
5d3e80021a
commit
5b9299d8c7
2 changed files with 6 additions and 3 deletions
|
@ -17,9 +17,10 @@
|
||||||
|
|
||||||
The :mod:`operator` module exports a set of efficient functions corresponding to
|
The :mod:`operator` module exports a set of efficient functions corresponding to
|
||||||
the intrinsic operators of Python. For example, ``operator.add(x, y)`` is
|
the intrinsic operators of Python. For example, ``operator.add(x, y)`` is
|
||||||
equivalent to the expression ``x+y``. The function names are those used for
|
equivalent to the expression ``x+y``. Many function names are those used for
|
||||||
special class methods; variants without leading and trailing ``__`` are also
|
special methods, without the double underscores. For backward compatibility,
|
||||||
provided for convenience.
|
many of these have a variant with the double underscores kept. The variants
|
||||||
|
without the double underscores are preferred for clarity.
|
||||||
|
|
||||||
The functions fall into categories that perform object comparisons, logical
|
The functions fall into categories that perform object comparisons, logical
|
||||||
operations, mathematical operations and sequence operations.
|
operations, mathematical operations and sequence operations.
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
The operator functions without double underscores are preferred for clarity.
|
||||||
|
The one with underscores are only kept for back-compatibility.
|
Loading…
Add table
Add a link
Reference in a new issue