From 3fbe20c01ea63aac0b06afdcb22422e8cb9a358e Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 21 Mar 2008 19:20:21 +0000 Subject: Add docs for __func__ and __self__ on methods. --- Doc/library/inspect.rst | 8 ++++---- Doc/reference/datamodel.rst | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 92c3ef9..4ee68f6 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -54,12 +54,12 @@ attributes: | | im_class | class object that asked | \(1) | | | | for this method | | +-----------+-----------------+---------------------------+-------+ -| | im_func | function object | | -| | | containing implementation | | +| | im_func or | function object | | +| | __func__ | containing implementation | | | | | of method | | +-----------+-----------------+---------------------------+-------+ -| | im_self | instance to which this | | -| | | method is bound, or | | +| | im_self or | instance to which this | | +| | __self__ | method is bound, or | | | | | ``None`` | | +-----------+-----------------+---------------------------+-------+ | function | __doc__ | documentation string | | diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 8ae94af..cc71420 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -555,6 +555,10 @@ Callable types .. versionchanged:: 2.2 :attr:`im_self` used to refer to the class that defined the method. + .. versionchanged:: 2.6 + For 3.0 forward-compatibility, :attr:`im_func` is also available as + :attr:`__func__`, and :attr:`im_self` as :attr:`__self__`. + .. index:: single: __doc__ (method attribute) single: __name__ (method attribute) -- cgit v0.12