Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de5d5ce

Browse files
committed
Update getattr() description to document the optional third
parameter. Thanks to Barry Warsaw for pointing out the oversight.
1 parent 06c5a8b commit de5d5ce

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Doc/lib/libfuncs.tex

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,13 @@ \section{Built-in Functions \label{built-in-funcs}}
259259
and is known to vary.
260260
\end{funcdesc}
261261

262-
\begin{funcdesc}{getattr}{object, name}
263-
The arguments are an object and a string. The string must be the
264-
name of one of the object's attributes. The result is the value of
265-
that attribute. For example, \code{getattr(\var{x},
266-
'\var{foobar}')} is equivalent to \code{\var{x}.\var{foobar}}.
262+
\begin{funcdesc}{getattr}{object, name\optional{, default}}
263+
Return the value of the named attributed of \var{object}. \var{name}
264+
must be a string. If the string is the name of one of the object's
265+
attributes, the result is the value of that attribute. For example,
266+
\code{getattr(x, 'foobar')} is equivalent to \code{x.foobar}. If the
267+
named attribute does not exist, \var{default} is returned if provided,
268+
otherwise \exception{AttributeError} is raised.
267269
\end{funcdesc}
268270

269271
\begin{funcdesc}{globals}{}

0 commit comments

Comments
 (0)