diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-08-03 07:17:51 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-08-03 07:17:51 (GMT) |
commit | 91494d3b738bf48a5a8fc2d98fbf2912b09e8ae0 (patch) | |
tree | addc78043f2b893ff52621de5e3762240e6eadbd /Doc/reference | |
parent | 43746c37704861947179185b4c037e5f18f89a7c (diff) | |
parent | 6cafececbf4aaccc2edbefa9298ed54da27dadda (diff) | |
download | cpython-91494d3b738bf48a5a8fc2d98fbf2912b09e8ae0.zip cpython-91494d3b738bf48a5a8fc2d98fbf2912b09e8ae0.tar.gz cpython-91494d3b738bf48a5a8fc2d98fbf2912b09e8ae0.tar.bz2 |
Issue #26576: Merge from 3.5
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/compound_stmts.rst | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index e1a7f57..1c5bbdf 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -503,11 +503,13 @@ are applied in nested fashion. For example, the following code :: @f2 def func(): pass -is equivalent to :: +is roughly equivalent to :: def func(): pass func = f1(arg)(f2(func)) +except that the original function is not temporarily bound to the name ``func``. + .. index:: triple: default; parameter; value single: argument; function definition @@ -638,14 +640,13 @@ Classes can also be decorated: just like when decorating functions, :: @f2 class Foo: pass -is equivalent to :: +is roughly equivalent to :: class Foo: pass Foo = f1(arg)(f2(Foo)) The evaluation rules for the decorator expressions are the same as for function -decorators. The result must be a class object, which is then bound to the class -name. +decorators. The result is then bound to the class name. **Programmer's note:** Variables defined in the class definition are class attributes; they are shared by instances. Instance attributes can be set in a |