[Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.66,1.67

Barry Warsaw bwarsaw@users.sourceforge.net
Tue, 14 Aug 2001 11:22:26 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv30178

Modified Files:
	libstdtypes.tex 
Log Message:
Describe the new semantics for setting and deleting a function's
__dict__ attribute.  Deleting it, or setting it to a non-dictionary
result in a TypeError.  Note that getting it the first time magically
initializes it to an empty dict so that func.__dict__ will always
appear to be a dictionary (never None).

Closes SF bug #446645.


Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** libstdtypes.tex	2001/07/26 21:01:21	1.66
--- libstdtypes.tex	2001/08/14 18:22:24	1.67
***************
*** 1048,1064 ****
  Regular attribute dot-notation is used to get and set such
  attributes. \emph{Note that the current implementation only supports
! function attributes on functions written in Python.  Function
! attributes on built-ins may be supported in the future.}
  
  Functions have another special attribute \code{\var{f}.__dict__}
  (a.k.a. \code{\var{f}.func_dict}) which contains the namespace used to
! support function attributes.  \code{__dict__} can be accessed
! directly, set to a dictionary object, or \code{None}.  It can also be
! deleted (but the following two lines are equivalent):
! 
! \begin{verbatim}
! del func.__dict__
! func.__dict__ = None
! \end{verbatim}
  
  \subsubsection{Methods \label{typesmethods}}
--- 1048,1059 ----
  Regular attribute dot-notation is used to get and set such
  attributes. \emph{Note that the current implementation only supports
! function attributes on user-defined functions.  Function attributes on
! built-in functions may be supported in the future.}
  
  Functions have another special attribute \code{\var{f}.__dict__}
  (a.k.a. \code{\var{f}.func_dict}) which contains the namespace used to
! support function attributes.  \code{__dict__} and \code{func_dict} can
! be accessed directly or set to a dictionary object.  A function's
! dictionary cannot be deleted.
  
  \subsubsection{Methods \label{typesmethods}}