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
3d4c316f
Commit
3d4c316f
authored
Nov 12, 2007
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new decorator syntax to property.__doc__
Guido prefers _x over __x.
parent
03c1d1e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
Objects/descrobject.c
Objects/descrobject.c
+14
-4
No files found.
Objects/descrobject.c
View file @
3d4c316f
...
...
@@ -1268,10 +1268,20 @@ PyDoc_STRVAR(property_doc,
"fset is a function for setting, and fdel a function for del'ing, an
\n
"
"attribute. Typical use is to define a managed attribute x:
\n
"
"class C(object):
\n
"
" def getx(self): return self.__x
\n
"
" def setx(self, value): self.__x = value
\n
"
" def delx(self): del self.__x
\n
"
" x = property(getx, setx, delx,
\"
I'm the 'x' property.
\"
)"
);
" def getx(self): return self._x
\n
"
" def setx(self, value): self._x = value
\n
"
" def delx(self): del self._x
\n
"
" x = property(getx, setx, delx,
\"
I'm the 'x' property.
\"
)
\n
"
"
\n
"
"Decorators makes defining new or modifying existing properties easy:
\n
"
"class C(object):
\n
"
" @property
\n
"
" def x(self): return self._x
\n
"
" @x.setter
\n
"
" def x(self, value): self._x = value
\n
"
" @x.deleter
\n
"
" def x(self): del self._x
\n
"
);
static
int
property_traverse
(
PyObject
*
self
,
visitproc
visit
,
void
*
arg
)
...
...
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