diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-08-14 00:25:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-14 00:25:38 (GMT) |
commit | 43bab0537ceb6e2ca3597f8f3a3c79733b897434 (patch) | |
tree | 41cf459ac954b4918db8213d2e9d6abcb3ceddf2 | |
parent | 282fc5c00787297f1d7a9b7b1469b51e84f485a9 (diff) | |
download | cpython-43bab0537ceb6e2ca3597f8f3a3c79733b897434.zip cpython-43bab0537ceb6e2ca3597f8f3a3c79733b897434.tar.gz cpython-43bab0537ceb6e2ca3597f8f3a3c79733b897434.tar.bz2 |
bpo-44907: Update error messages in tutorial examples (GH-27755)
(cherry picked from commit ed524b4569b1e4a166886c880018418d46284378)
Co-authored-by: meowmeowmeowcat <meowmeowcat1211@gmail.com>
-rw-r--r-- | Doc/tutorial/controlflow.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index 129ab21..08202f0 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -479,7 +479,7 @@ Here's an example that fails due to this restriction:: >>> function(0, a=0) Traceback (most recent call last): File "<stdin>", line 1, in <module> - TypeError: function() got multiple values for keyword argument 'a' + TypeError: function() got multiple values for argument 'a' When a final formal parameter of the form ``**name`` is present, it receives a dictionary (see :ref:`typesmapping`) containing all keyword arguments except for @@ -615,7 +615,7 @@ parameters as there is a ``/`` in the function definition:: >>> pos_only_arg(arg=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> - TypeError: pos_only_arg() got an unexpected keyword argument 'arg' + TypeError: pos_only_arg() got some positional-only arguments passed as keyword arguments: 'arg' The third function ``kwd_only_args`` only allows keyword arguments as indicated by a ``*`` in the function definition:: @@ -645,7 +645,7 @@ definition:: >>> combined_example(pos_only=1, standard=2, kwd_only=3) Traceback (most recent call last): File "<stdin>", line 1, in <module> - TypeError: combined_example() got an unexpected keyword argument 'pos_only' + TypeError: combined_example() got some positional-only arguments passed as keyword arguments: 'pos_only' Finally, consider this function definition which has a potential collision between the positional argument ``name`` and ``**kwds`` which has ``name`` as a key:: |