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 John Hossbach
Recipients John Hossbach, docs@python
Date 2018-02-04.17:57:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1517767044.74.0.467229070634.issue32766@psf.upfronthosting.co.za>
In-reply-to
Content
https://docs.python.org/3.5/tutorial/controlflow.html#function-annotations

The end of the first paragraph states, "The following example has a positional argument, a keyword argument, and the return value annotated:"

However, the only function call is f('spam') which has a single positional argument.

I believe the author was referencing the output of print("Annotations:", f.__annotations__) which was:
Annotations: {'ham': <class 'str'>, 'return': <class 'str'>, 'eggs': <class 'str'>}

and then confused that with 4.7.2. Keyword Arguments (https://docs.python.org/3.5/tutorial/controlflow.html#keyword-arguments) where it points out that keyword arguments follow positional arguments.  However, the difference between identifying a positional argument vs keyword argument is done at the function CALL, not the function DEFINITION since any argument can be both positional or keyword, depending on how it is referenced.

Moreover, the last sentence in 4.7.2. Keyword Arguments, points out that the order of unsorted sequences is undefined, which would then explain why 'return' appears in the middle here instead of at the end.
History
Date User Action Args
2018-02-04 17:57:24John Hossbachsetrecipients: + John Hossbach, docs@python
2018-02-04 17:57:24John Hossbachsetmessageid: <1517767044.74.0.467229070634.issue32766@psf.upfronthosting.co.za>
2018-02-04 17:57:24John Hossbachlinkissue32766 messages
2018-02-04 17:57:24John Hossbachcreate