]> granicus.if.org Git - python/commitdiff
bpo-30085: Improve documentation for operator (#1171)
authorSanket Dasgupta <sanketdasgupta@gmail.com>
Sun, 24 Sep 2017 18:29:22 +0000 (23:59 +0530)
committerTerry Jan Reedy <tjreedy@udel.edu>
Sun, 24 Sep 2017 18:29:22 +0000 (14:29 -0400)
The dunderless functions are preferred; dunder are retained for back compatilibity.
Patch by Sanket Dasgupta.

Doc/library/operator.rst
Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst [new file with mode: 0644]

index 76335b179c58f8c9d4c5ecf6bd00e4059b09093c..e4d6d05a23a7c40f8afab59d7c821e4a6850f3e6 100644 (file)
 
 The :mod:`operator` module exports a set of efficient functions corresponding to
 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
-special class methods; variants without leading and trailing ``__`` are also
-provided for convenience.
+equivalent to the expression ``x+y``. Many function names are those used for
+special methods, without the double underscores.  For backward compatibility,
+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
 operations, mathematical operations and sequence operations.
diff --git a/Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst b/Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst
new file mode 100644 (file)
index 0000000..c8be050
--- /dev/null
@@ -0,0 +1,2 @@
+The operator functions without double underscores are preferred for clarity.
+The one with underscores are only kept for back-compatibility.