summaryrefslogtreecommitdiffstats
path: root/Doc/faq/programming.rst
diff options
context:
space:
mode:
authorAmmar Askar <ammar@ammaraskar.com>2019-09-21 04:28:49 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-21 04:28:49 (GMT)
commit87d6cd3604e5c83c06339276228139f5e040b0e7 (patch)
tree8625c8ec9abe6f81b425b742d9a8e0ab2785e4e3 /Doc/faq/programming.rst
parente267793aa4101b2771ed0e66aaff5743d23f59af (diff)
downloadcpython-87d6cd3604e5c83c06339276228139f5e040b0e7.zip
cpython-87d6cd3604e5c83c06339276228139f5e040b0e7.tar.gz
cpython-87d6cd3604e5c83c06339276228139f5e040b0e7.tar.bz2
bpo-38237: Make pow's arguments have more descriptive names and be keyword passable (GH-16302)
Edit: `math.pow` changes removed on Mark's request. https://bugs.python.org/issue38237 Automerge-Triggered-By: @rhettinger
Diffstat (limited to 'Doc/faq/programming.rst')
-rw-r--r--Doc/faq/programming.rst25
1 files changed, 11 insertions, 14 deletions
diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst
index 2ff7236..9d45765 100644
--- a/Doc/faq/programming.rst
+++ b/Doc/faq/programming.rst
@@ -779,26 +779,23 @@ A slash in the argument list of a function denotes that the parameters prior to
it are positional-only. Positional-only parameters are the ones without an
externally-usable name. Upon calling a function that accepts positional-only
parameters, arguments are mapped to parameters based solely on their position.
-For example, :func:`pow` is a function that accepts positional-only parameters.
-Its documentation looks like this::
+For example, :func:`divmod` is a function that accepts positional-only
+parameters. Its documentation looks like this::
- >>> help(pow)
- Help on built-in function pow in module builtins:
+ >>> help(divmod)
+ Help on built-in function divmod in module builtins:
- pow(x, y, z=None, /)
- Equivalent to x**y (with two arguments) or x**y % z (with three arguments)
+ divmod(x, y, /)
+ Return the tuple (x//y, x%y). Invariant: div*y + mod == x.
- Some types, such as ints, are able to use a more efficient algorithm when
- invoked using the three argument form.
+The slash at the end of the parameter list means that both parameters are
+positional-only. Thus, calling :func:`divmod` with keyword arguments would lead
+to an error::
-The slash at the end of the parameter list means that all three parameters are
-positional-only. Thus, calling :func:`pow` with keyword arguments would lead to
-an error::
-
- >>> pow(x=3, y=4)
+ >>> divmod(x=3, y=4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
- TypeError: pow() takes no keyword arguments
+ TypeError: divmod() takes no keyword arguments
Numbers and strings