summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2004-08-12 18:12:44 (GMT)
committerMichael W. Hudson <mwh@python.net>2004-08-12 18:12:44 (GMT)
commit5e897959db37752da4c6b476903cdc5e1357093c (patch)
tree73745bf828ac5d8d77254a9d2895169ae6bbae3c /Doc
parent5523c2517f14aed04f94865189ce986040652415 (diff)
downloadcpython-5e897959db37752da4c6b476903cdc5e1357093c.zip
cpython-5e897959db37752da4c6b476903cdc5e1357093c.tar.gz
cpython-5e897959db37752da4c6b476903cdc5e1357093c.tar.bz2
This is my patch
[ 1004703 ] Make func_name writable plus fixing a couple of nits in the documentation changes spotted by MvL and a Misc/NEWS entry.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libstdtypes.tex21
-rw-r--r--Doc/ref/ref3.tex71
2 files changed, 51 insertions, 41 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex
index 01e800a..e97009e 100644
--- a/Doc/lib/libstdtypes.tex
+++ b/Doc/lib/libstdtypes.tex
@@ -1682,25 +1682,8 @@ and user-defined functions. Both support the same operation (to call
the function), but the implementation is different, hence the
different object types.
-The implementation adds two special read-only attributes:
-\code{\var{f}.func_code} is a function's \dfn{code
-object}\obindex{code} (see below) and \code{\var{f}.func_globals} is
-the dictionary used as the function's global namespace (this is the
-same as \code{\var{m}.__dict__} where \var{m} is the module in which
-the function \var{f} was defined).
-
-Function objects also support getting and setting arbitrary
-attributes, which can be used, for example, to attach metadata to
-functions. 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.
+See the \citetitle[../ref/ref.html]{Python Reference Manual} for more
+information.
\subsubsection{Methods \label{typesmethods}}
\obindex{method}
diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex
index 7f337f6..973275f 100644
--- a/Doc/ref/ref3.tex
+++ b/Doc/ref/ref3.tex
@@ -433,28 +433,55 @@ parameter list.
\obindex{function}
\obindex{user-defined function}
-Special attributes: \member{func_doc} or \member{__doc__} is the
-function's documentation string, or \code{None} if unavailable;
-\member{func_name} or \member{__name__} is the function's name;
-\member{__module__} is the name of the module the function was defined
-in, or \code{None} if unavailable;
-\member{func_defaults} is a tuple containing default argument values for
-those arguments that have defaults, or \code{None} if no arguments
-have a default value; \member{func_code} is the code object representing
-the compiled function body; \member{func_globals} is (a reference to)
-the dictionary that holds the function's global variables --- it
-defines the global namespace of the module in which the function was
-defined; \member{func_dict} or \member{__dict__} contains the
-namespace supporting arbitrary function attributes;
-\member{func_closure} is \code{None} or a tuple of cells that contain
-bindings for the function's free variables.
-
-Of these, \member{func_code}, \member{func_defaults},
-\member{func_doc}/\member{__doc__}, and
-\member{func_dict}/\member{__dict__} may be writable; the
-others can never be changed. Additional information about a
-function's definition can be retrieved from its code object; see the
-description of internal types below.
+Special attributes:
+
+\begin{tableiii}{lll}{member}{Attribute}{Meaning}{}
+ \lineiii{func_doc}{The function's documentation string, or
+ \code{None} if unavailable}{Writable}
+
+ \lineiii{__doc__}{Another way of spelling
+ \member{func_doc}}{Writable}
+
+ \lineiii{func_name}{The function's name}{Writable}
+
+ \lineiii{__name__}{Another way of spelling
+ \member{func_name}}{Writable}
+
+ \lineiii{__module__}{The name of the module the function was defined
+ in, or \code{None} if unavailable.}{Writable}
+
+ \lineiii{func_defaults}{Atuple containing default argument values
+ for those arguments that have defaults, or \code{None} if no
+ arguments have a default value}{Writable}
+
+ \lineiii{func_code}{The code object representing the compiled
+ function body.}{Writable}
+
+ \lineiii{func_globals}{A reference to the dictionary that holds the
+ function's global variables --- the global namespace of the module
+ in which the function was defined.}{Read-only}
+
+ \lineiii{func_dict}{The namespace supporting arbitrary function
+ attributes.}{Writable}
+
+ \lineiii{func_closure}{\code{None} or a tuple of cells that contain
+ bindings for the function's free variables.}{Read-only}
+\end{tableiii}
+
+Most of the attributes labelled ``Writable'' check the type of the
+assigned value.
+
+\versionchanged[\code{func_name} is now writable]{2.4}
+
+Function objects also support getting and setting arbitrary
+attributes, which can be used, for example, to attach metadata to
+functions. 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.}
+
+Additional information about a function's definition can be retrieved
+from its code object; see the description of internal types below.
\withsubitem{(function attribute)}{
\ttindex{func_doc}