@@ -415,9 +415,12 @@ \section{The standard type hierarchy\label{types}}
415415the compiled function body; \member {func_globals} is (a reference to)
416416the dictionary that holds the function's global variables --- it
417417defines the global namespace of the module in which the function was
418- defined.
419- Of these, \member {func_code}, \member {func_defaults} and
420- \member {func_doc} (and this \member {__doc__}) may be writable; the
418+ defined; \member {func_dict} or \member {__dict__} contains the
419+ namespace supporting arbitrary function attributes.
420+
421+ Of these, \member {func_code}, \member {func_defaults},
422+ \member {func_doc}/\member {__doc__}, and
423+ \member {func_dict}/\member {__dict__} may be writable; the
421424others can never be changed.
422425Additional information about a function's definition can be
423426retrieved from its code object; see the description of internal types
@@ -426,9 +429,11 @@ \section{The standard type hierarchy\label{types}}
426429 \ttindex {func_doc}
427430 \ttindex {__doc__}
428431 \ttindex {__name__}
432+ \ttindex {__dict__}
429433 \ttindex {func_defaults}
430434 \ttindex {func_code}
431- \ttindex {func_globals}}
435+ \ttindex {func_globals}
436+ \ttindex {func_dict}}
432437\indexii {global}{namespace}
433438
434439\item [User-defined methods]
@@ -449,6 +454,9 @@ \section{The standard type hierarchy\label{types}}
449454 \ttindex {im_func}
450455 \ttindex {im_self}}
451456
457+ Methods also support accessing (but not setting) the arbitrary
458+ function attributes on the underlying function object.
459+
452460User-defined method objects are created in two ways: when getting an
453461attribute of a class that is a user-defined function object, or when
454462getting an attribute of a class instance that is a user-defined
0 commit comments