Original Translation
57
with A() as a: with B() as b: suite
58
See also
59
The specification, background, and examples for the Python :keyword:`with` statement.
60
Function definitions
61
A function definition defines a user-defined function object (see section :ref:`types`):
62
A function definition is an executable statement. Its execution binds the function name in the current local namespace to a function object (a wrapper around the executable code for the function). This function object contains a reference to the current global namespace as the global namespace to be used when the function is called.
63
The function definition does not execute the function body; this gets executed only when the function is called. [#]_
64
A function definition may be wrapped by one or more :term:`decorator` expressions. Decorator expressions are evaluated when the function is defined, in the scope that contains the function definition. The result must be a callable, which is invoked with the function object as the only argument. The returned value is bound to the function name instead of the function object. Multiple decorators are applied in nested fashion. For example, the following code ::
65
@f1(arg) @f2 def func(): pass
66
def func(): pass func = f1(arg)(f2(func))