[issue14187] add "annotation" entry to Glossary

Chris Rebert report at bugs.python.org
Mon Mar 12 01:14:32 CET 2012


Chris Rebert <pybugs at rebertia.com> added the comment:

Strawman entry wording:

An annotation is an arbitrary metadata value associated with a function parameter or return value. The syntax for function annotations is explained in [Function definitions][http://docs.python.org/dev/reference/compound_stmts.html#function-definitions]. Annotations may be accessed via the [__annotations__][http://docs.python.org/dev/reference/datamodel.html#the-standard-type-hierarchy : Callable types -> User-defined functions -> Special attributes] special attribute of a function object.

Python itself does not assign any particular meaning to function annotations; they are intended to be interpreted by third-party libraries or tools. Annotations were added to Python by [PEP 3107 "Function Annotations"][http://www.python.org/dev/peps/pep-3107/], which describes some of their possible uses.

Some other languages (e.g. Java, C#) also have a concept of "annotations", but it is distinct from the Python concept; the purpose of these "annotations" is served in Python using [decorators]["decorator" entry in Glossary] instead.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14187>
_______________________________________


More information about the Python-bugs-list mailing list