summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-02-27 03:36:30 (GMT)
committerBarry Warsaw <barry@python.org>2001-02-27 03:36:30 (GMT)
commit7a5e80e80102da1b41ecfeccc9095e5b84b8d154 (patch)
treed69fdb3510b8081b482c8e7ccfe751e2bd14d77b /Doc
parentd4614e8371941d9dff789cdd7f9d610f69bdd300 (diff)
downloadcpython-7a5e80e80102da1b41ecfeccc9095e5b84b8d154.zip
cpython-7a5e80e80102da1b41ecfeccc9095e5b84b8d154.tar.gz
cpython-7a5e80e80102da1b41ecfeccc9095e5b84b8d154.tar.bz2
Updates to describe function attributes.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/ref/ref3.tex16
1 files changed, 12 insertions, 4 deletions
diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex
index bd876cc..4aa218f 100644
--- a/Doc/ref/ref3.tex
+++ b/Doc/ref/ref3.tex
@@ -415,9 +415,12 @@ 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.
-Of these, \member{func_code}, \member{func_defaults} and
-\member{func_doc} (and this \member{__doc__}) may be writable; the
+defined; \member{func_dict} or \member{__dict__} contains the
+namespace supporting arbitrary function attributes.
+
+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
@@ -426,9 +429,11 @@ below.
\ttindex{func_doc}
\ttindex{__doc__}
\ttindex{__name__}
+ \ttindex{__dict__}
\ttindex{func_defaults}
\ttindex{func_code}
- \ttindex{func_globals}}
+ \ttindex{func_globals}
+ \ttindex{func_dict}}
\indexii{global}{namespace}
\item[User-defined methods]
@@ -449,6 +454,9 @@ base class of the class of which \member{im_self} is an instance);
\ttindex{im_func}
\ttindex{im_self}}
+Methods also support accessing (but not setting) the arbitrary
+function attributes on the underlying function object.
+
User-defined method objects are created in two ways: when getting an
attribute of a class that is a user-defined function object, or when
getting an attribute of a class instance that is a user-defined