New submission from John Hossbach <john.hossb...@gmail.com>: 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. ---------- 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 <rep...@bugs.python.org> <https://bugs.python.org/issue32766> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com