Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6cafecec
Commit
6cafecec
authored
Aug 03, 2016
by
Berker Peksag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #26576: Clarify that the @deco syntax is not always an equivalent of f = deco(f)
Patch by Chris Angelico.
parent
e12a68be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
Doc/reference/compound_stmts.rst
Doc/reference/compound_stmts.rst
+5
-4
No files found.
Doc/reference/compound_stmts.rst
View file @
6cafecec
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment