New submission from John Hossbach <>:

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 

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

and then confused that with 4.7.2. 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.

assignee: docs@python
components: Documentation
messages: 311612
nosy: John Hossbach, docs@python
priority: normal
severity: normal
status: open
title: 4.7.7. Function Annotations
versions: Python 3.5

Python tracker <>
Python-bugs-list mailing list

Reply via email to