Message155423
| Author |
cvrebert |
| Recipients |
cvrebert, docs@python, eric.araujo, ezio.melotti, rhettinger |
| Date |
2012年03月12日.00:14:31 |
| SpamBayes Score |
0.0015951062 |
| Marked as misclassified |
No |
| Message-id |
<1331511272.21.0.909972779247.issue14187@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|