This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients docs@python, mark.dickinson, r0b, terry.reedy
Date 2020-01-11.00:52:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1578703967.52.0.483982111405.issue39231@roundup.psfhosted.org>
In-reply-to
Content
https://docs.python.org/3/tutorial/controlflow.html#function-annotations
is the direct link.

As Mark said, 'ham' is a required positional-or-keyword argument.
'eggs' is an optional 'positional-or-keyword.  The sentence as is is wrong, even if Robert garbled the reason.  With the signature as it, the sentence should be "The following example has a required argument, an optional argument, and the return value annotated."

To make the existing sentence true, the signature could be changed to
  def f(ham: str, /, *, eggs: str) -> str:
But I think this would be wrong.  Annotation does not depend on how an argument is passed, but whether it has a default (making it optional).  In particular, it shows that when optional, the annotation goes *before* '= default', not after.  (It could have gone after: eggs = 'eggs': str.)
History
Date User Action Args
2020-01-11 00:52:47terry.reedysetrecipients: + terry.reedy, mark.dickinson, docs@python, r0b
2020-01-11 00:52:47terry.reedysetmessageid: <1578703967.52.0.483982111405.issue39231@roundup.psfhosted.org>
2020-01-11 00:52:47terry.reedylinkissue39231 messages
2020-01-11 00:52:47terry.reedycreate