Skip to content

Commit

Permalink
bpo-36908: 'This module is always available' isn't helpful. (GH-13297)
Browse files Browse the repository at this point in the history
Makes the documentation of math and cmath module
more helpful for the beginners.
(cherry picked from commit 6faad35)

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
  • Loading branch information
miss-islington and nedbat committed May 17, 2019
1 parent 5386aaf commit 740a7cd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
13 changes: 6 additions & 7 deletions Doc/library/cmath.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

--------------

This module is always available. It provides access to mathematical functions
for complex numbers. The functions in this module accept integers,
floating-point numbers or complex numbers as arguments. They will also accept
any Python object that has either a :meth:`__complex__` or a :meth:`__float__`
method: these methods are used to convert the object to a complex or
floating-point number, respectively, and the function is then applied to the
result of the conversion.
This module provides access to mathematical functions for complex numbers. The
functions in this module accept integers, floating-point numbers or complex
numbers as arguments. They will also accept any Python object that has either a
:meth:`__complex__` or a :meth:`__float__` method: these methods are used to
convert the object to a complex or floating-point number, respectively, and
the function is then applied to the result of the conversion.

.. note::

Expand Down
4 changes: 2 additions & 2 deletions Doc/library/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

--------------

This module is always available. It provides access to the mathematical
functions defined by the C standard.
This module provides access to the mathematical functions defined by the C
standard.

These functions cannot be used with complex numbers; use the functions of the
same name from the :mod:`cmath` module if you require support for complex
Expand Down
4 changes: 2 additions & 2 deletions Modules/cmathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,8 +1232,8 @@ cmath_isclose_impl(PyObject *module, Py_complex a, Py_complex b,
}

PyDoc_STRVAR(module_doc,
"This module is always available. It provides access to mathematical\n"
"functions for complex numbers.");
"This module provides access to mathematical functions for complex\n"
"numbers.");

static PyMethodDef cmath_methods[] = {
CMATH_ACOS_METHODDEF
Expand Down
4 changes: 2 additions & 2 deletions Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2371,8 +2371,8 @@ static PyMethodDef math_methods[] = {


PyDoc_STRVAR(module_doc,
"This module is always available. It provides access to the\n"
"mathematical functions defined by the C standard.");
"This module provides access to the mathematical functions\n"
"defined by the C standard.");


static struct PyModuleDef mathmodule = {
Expand Down

0 comments on commit 740a7cd

Please sign in to comment.