[Python-checkins] r47181 - python/trunk/Doc/lib/libfuncs.tex
Georg Brandl
g.brandl at gmx.net
Fri Jun 30 22:02:33 CEST 2006
fred.drake wrote:
> Author: fred.drake
> Date: Fri Jun 30 21:29:25 2006
> New Revision: 47181
>
> Modified:
> python/trunk/Doc/lib/libfuncs.tex
> Log:
> - consistency nit: always include "()" in \function and \method
> (*should* be done by the presentation, but that requires changes all over)
> - avoid spreading the __name meme
>
>
> Modified: python/trunk/Doc/lib/libfuncs.tex
> ==============================================================================
> --- python/trunk/Doc/lib/libfuncs.tex (original)
> +++ python/trunk/Doc/lib/libfuncs.tex Fri Jun 30 21:29:25 2006
> @@ -781,30 +781,30 @@
> \begin{verbatim}
> class C(object):
> def __init__(self): self.__x = None
> - def getx(self): return self.__x
> - def setx(self, value): self.__x = value
> - def delx(self): del self.__x
> + def getx(self): return self._x
> + def setx(self, value): self._x = value
> + def delx(self): del self._x
> 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). This makes it possible to create read-only properties
> - easily using \function{property} as a decorator:
> + easily using \function{property()} as a decorator:
Note that I left out the parens here intentionally since they mustn't be
used when writing the decorator, just to avoid possible mistakes.
Georg
More information about the Python-checkins
mailing list