mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Patch #1434038: property() now uses the getter's docstring if there is
no "doc" argument given. This makes it possible to legitimately use property() as a decorator to produce a read-only property.
This commit is contained in:
parent
f3c4ad1410
commit
533ff6fc06
4 changed files with 33 additions and 0 deletions
|
@ -771,7 +771,12 @@ class C(object):
|
|||
x = property(getx, setx, delx, "I'm the 'x' property.")
|
||||
\end{verbatim}
|
||||
|
||||
If given, \var{doc} will be the docstring of the property attribute.
|
||||
Otherwise, the property will copy \var{fget}'s docstring (if it
|
||||
exists).
|
||||
|
||||
\versionadded{2.2}
|
||||
\versionchanged[Use \var{fget}'s docstring if no \var{doc} given]{2.5}
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{range}{\optional{start,} stop\optional{, step}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue