]> granicus.if.org Git - python/commitdiff
- consistency nit: always include "()" in \function and \method
authorFred Drake <fdrake@acm.org>
Fri, 30 Jun 2006 19:29:25 +0000 (19:29 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 30 Jun 2006 19:29:25 +0000 (19:29 +0000)
  (*should* be done by the presentation, but that requires changes all over)
- avoid spreading the __name meme

Doc/lib/libfuncs.tex

index 54b25959c42f4db5e36398378b054514923eb20a..860321d637e1c90ce58597658cbd50363ac5dc8b 100644 (file)
@@ -781,30 +781,30 @@ class C:
 \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:
 
 \begin{verbatim}
 class Parrot(object):
     def __init__(self):
-        self.__voltage = 100000
+        self._voltage = 100000
 
     @property
     def voltage(self):
         """Get the current voltage."""
-        return self.__voltage
+        return self._voltage
 \end{verbatim}
 
-  turns the \method{voltage} method into a "getter" for a read-only attribute
-  with the same name.
+  turns the \method{voltage()} method into a ``getter'' for a read-only
+  attribute with the same name.
 
   \versionadded{2.2}
   \versionchanged[Use \var{fget}'s docstring if no \var{doc} given]{2.5}