Skip to content

Commit ed524b4

Browse files
authored
bpo-44907: Update error messages in tutorial examples (GH-27755)
1 parent e4ed9d2 commit ed524b4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/tutorial/controlflow.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ Here's an example that fails due to this restriction::
651651
>>> function(0, a=0)
652652
Traceback (most recent call last):
653653
File "<stdin>", line 1, in <module>
654-
TypeError: function() got multiple values for keyword argument 'a'
654+
TypeError: function() got multiple values for argument 'a'
655655

656656
When a final formal parameter of the form ``**name`` is present, it receives a
657657
dictionary (see :ref:`typesmapping`) containing all keyword arguments except for
@@ -787,7 +787,7 @@ parameters as there is a ``/`` in the function definition::
787787
>>> pos_only_arg(arg=1)
788788
Traceback (most recent call last):
789789
File "<stdin>", line 1, in <module>
790-
TypeError: pos_only_arg() got an unexpected keyword argument 'arg'
790+
TypeError: pos_only_arg() got some positional-only arguments passed as keyword arguments: 'arg'
791791

792792
The third function ``kwd_only_args`` only allows keyword arguments as indicated
793793
by a ``*`` in the function definition::
@@ -817,7 +817,7 @@ definition::
817817
>>> combined_example(pos_only=1, standard=2, kwd_only=3)
818818
Traceback (most recent call last):
819819
File "<stdin>", line 1, in <module>
820-
TypeError: combined_example() got an unexpected keyword argument 'pos_only'
820+
TypeError: combined_example() got some positional-only arguments passed as keyword arguments: 'pos_only'
821821

822822

823823
Finally, consider this function definition which has a potential collision between the positional argument ``name`` and ``**kwds`` which has ``name`` as a key::

0 commit comments

Comments
 (0)