Skip to content

Commit

Permalink
bpo-38237: Use divmod for positional arguments whatsnew example (GH-1…
Browse files Browse the repository at this point in the history
…9171)

(cherry picked from commit 5a58c52)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
  • Loading branch information
miss-islington and ammaraskar committed Mar 27, 2020
1 parent 8dad09a commit 9c5c497
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Doc/whatsnew/3.8.rst
Expand Up @@ -144,12 +144,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
Expand Down

0 comments on commit 9c5c497

Please sign in to comment.