]> granicus.if.org Git - python/commitdiff
Update getattr() description to document the optional third
authorFred Drake <fdrake@acm.org>
Thu, 22 Jul 1999 19:21:45 +0000 (19:21 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 22 Jul 1999 19:21:45 +0000 (19:21 +0000)
parameter.  Thanks to Barry Warsaw for pointing out the oversight.

Doc/lib/libfuncs.tex

index 73aa5d44baf04528e029632d829af65ac4d2bff1..0506690c79d2cbdb6f2c34bedca98056d9a7437f 100644 (file)
@@ -259,11 +259,13 @@ removed.
   and is known to vary.
 \end{funcdesc}
 
-\begin{funcdesc}{getattr}{object, name}
-  The arguments are an object and a string.  The string must be the
-  name of one of the object's attributes.  The result is the value of
-  that attribute.  For example, \code{getattr(\var{x},
-  '\var{foobar}')} is equivalent to \code{\var{x}.\var{foobar}}.
+\begin{funcdesc}{getattr}{object, name\optional{, default}}
+  Return the value of the named attributed of \var{object}.  \var{name}
+  must be a string.  If the string is the name of one of the object's
+  attributes, the result is the value of that attribute.  For example,
+  \code{getattr(x, 'foobar')} is equivalent to \code{x.foobar}.  If the
+  named attribute does not exist, \var{default} is returned if provided,
+  otherwise \exception{AttributeError} is raised.
 \end{funcdesc}
 
 \begin{funcdesc}{globals}{}