summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew/3.8.rst
diff options
context:
space:
mode:
authorAmmar Askar <ammar@ammaraskar.com>2020-03-27 16:37:43 (GMT)
committerGitHub <noreply@github.com>2020-03-27 16:37:43 (GMT)
commit5a58c5280b8df4ca5d6a19892b24fff96e9ea868 (patch)
tree7b7de4a7fbcd5182849597549f72fa2d33f442e3 /Doc/whatsnew/3.8.rst
parent1c1e68cf3e3a2a19a0edca9a105273e11ddddc6e (diff)
downloadcpython-5a58c5280b8df4ca5d6a19892b24fff96e9ea868.zip
cpython-5a58c5280b8df4ca5d6a19892b24fff96e9ea868.tar.gz
cpython-5a58c5280b8df4ca5d6a19892b24fff96e9ea868.tar.bz2
bpo-38237: Use divmod for positional arguments whatsnew example (GH-19171)
Diffstat (limited to 'Doc/whatsnew/3.8.rst')
-rw-r--r--Doc/whatsnew/3.8.rst9
1 files changed, 4 insertions, 5 deletions
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 09047c4..18fb2e0 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -142,12 +142,11 @@ However, these are invalid calls::
One use case for this notation is that it allows pure Python functions
to fully emulate behaviors of existing C coded functions. For example,
-the built-in :func:`pow` function does not accept keyword arguments::
+the built-in :func:`divmod` function does not accept keyword arguments::
- def pow(x, y, z=None, /):
- "Emulate the built in pow() function"
- r = x ** y
- return r if z is None else r%z
+ def divmod(a, b, /):
+ "Emulate the built in divmod() function"
+ return (a // b, a % b)
Another use case is to preclude keyword arguments when the parameter
name is not helpful. For example, the builtin :func:`len` function has