cpython: 0acb8dcb8e0c (original) (raw)

Mercurial > cpython

changeset 95576:0acb8dcb8e0c 3.4

Issue #23932: Update the tutorial section on function annotations. Patch by Juti Noppornpitak. [#23932]

Zachary Ware zachary.ware@gmail.com
date Mon, 13 Apr 2015 11:30:47 -0500
parents 19f6f339af7e
children 75a6774ba070 640ccb924b5f 2c53a5302058
files Doc/tutorial/controlflow.rst
diffstat 1 files changed, 10 insertions(+), 11 deletions(-)[+] [-] Doc/tutorial/controlflow.rst 21

line wrap: on

line diff

--- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -673,11 +673,9 @@ Function Annotations pair: function; annotations single: -> (return annotation assignment) -:ref:Function annotations <function> are completely optional, -arbitrary metadata information about user-defined functions. Neither Python -itself nor the standard library use function annotations in any way; this -section just shows the syntax. Third-party projects are free to use function -annotations for documentation, type checking, and other uses. +:ref:Function annotations <function> are completely optional metadata +information about the types used by user-defined functions (see :pep:484 +for more information). Annotations are stored in the :attr:__annotations__ attribute of the function as a dictionary and have no effect on any other part of the function. Parameter @@ -686,16 +684,17 @@ expression evaluating to the value of th defined by a literal ->, followed by an expression, between the parameter list and the colon denoting the end of the :keyword:def statement. The following example has a positional argument, a keyword argument, and the return -value annotated with nonsense:: +value annotated::

.. _tut-codingstyle: