Clarify that the annotation dictionaries are mutable

This commit is contained in:
Collin Winter 2007-01-05 16:59:58 +00:00
parent 4226413f7b
commit e9a43d014c
1 changed files with 5 additions and 5 deletions

View File

@ -161,8 +161,8 @@ Accessing Function Annotations
Once compiled, a function's annotations are available via the
function's ``func_annotations`` attribute. This attribute is
a dictionary, mapping parameter names to an object representing
the evaluated annotation expression
a mutable dictionary, mapping parameter names to an object
representing the evaluated annotation expression
There is a special key in the ``func_annotations`` mapping,
``"return"``. This key is present only if an annotation was supplied
@ -184,9 +184,9 @@ The ``return`` key was chosen because it cannot conflict with the name
of a parameter; any attempt to use ``return`` as a parameter name
would result in a ``SyntaxError``.
``func_annotations`` is an empty dictionary if no there are no
annotations on the function. ``func_annotations`` is always an empty
dictionary for functions created from ``lambda`` expressions.
``func_annotations`` is an empty, mutable dictionary if there are no
annotations on the function or if the functions was created from
a ``lambda`` expression.
Use Cases
=========