[Python-checkins] CVS: python/dist/src/Doc/lib libfuncs.tex,1.100,1.100.4.1
Michael Hudson
mwh@users.sourceforge.net
Sat, 23 Feb 2002 00:31:40 -0800
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv9160
Modified Files:
Tag: release22-maint
libfuncs.tex
Log Message:
backport tim_one's checkin of
revision 1.101 of libfuncs.tex
SF bug #501591: dir() doc is old
Bugfix candidate.
+ Updated dir() description to match actual 2.2 behavior.
+ Replaced the dir(sys) example with dir(struct), because the former
was way out of date and is bound to change frequently, while the
latter is stable.
+ Added a note cautioning that dir() is supplied primarily for
convenience at an interactive prompt (hoping to discourage its
use as the foundation of introspective code outside the core).
Index: libfuncs.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v
retrieving revision 1.100
retrieving revision 1.100.4.1
diff -C2 -d -r1.100 -r1.100.4.1
*** libfuncs.tex 18 Dec 2001 16:31:08 -0000 1.100
--- libfuncs.tex 23 Feb 2002 08:31:37 -0000 1.100.4.1
***************
*** 207,224 ****
Without arguments, return the list of names in the current local
symbol table. With an argument, attempts to return a list of valid
! attribute for that object. This information is gleaned from the
object's \member{__dict__} attribute, if defined, and from the class
! or type object. The list is not necessarily complete. For
! example, for classes, attributes defined in base classes are not
! included, and for class instances, methods are not included.
! The resulting list is sorted alphabetically. For example:
\begin{verbatim}
! >>> import sys
>>> dir()
! ['sys']
! >>> dir(sys)
! ['argv', 'exit', 'modules', 'path', 'stderr', 'stdin', 'stdout']
\end{verbatim}
\end{funcdesc}
--- 207,237 ----
Without arguments, return the list of names in the current local
symbol table. With an argument, attempts to return a list of valid
! attributes for that object. This information is gleaned from the
object's \member{__dict__} attribute, if defined, and from the class
! or type object. The list is not necessarily complete.
! If the object is a module object, the list contains the names of the
! module's attributes.
! If the object is a type or class object,
! the list contains the names of its attributes,
! and recursively of the attributes of its bases.
! Otherwise, the list contains the object's attributes' names,
! the names of its class's attributes,
! and recursively of the attributes of its class's base classes.
! The resulting list is sorted alphabetically.
! For example:
\begin{verbatim}
! >>> import struct
>>> dir()
! ['__builtins__', '__doc__', '__name__', 'struct']
! >>> dir(struct)
! ['__doc__', '__name__', 'calcsize', 'error', 'pack', 'unpack']
\end{verbatim}
+
+ \note{Because \function{dir()} is supplied primarily as a convenience
+ for use at an interactive prompt,
+ it tries to supply an interesting set of names more than it tries to
+ supply a rigorously or consistently defined set of names,
+ and its detailed behavior may change across releases.}
\end{funcdesc}