[Python-checkins] r64643 - doctools/branches/0.4.x/doc/ext/autodoc.rst

georg.brandl python-checkins at python.org
Tue Jul 1 23:24:55 CEST 2008


Author: georg.brandl
Date: Tue Jul  1 23:24:55 2008
New Revision: 64643

Log:
Add a note about decorated functions.


Modified:
   doctools/branches/0.4.x/doc/ext/autodoc.rst

Modified: doctools/branches/0.4.x/doc/ext/autodoc.rst
==============================================================================
--- doctools/branches/0.4.x/doc/ext/autodoc.rst	(original)
+++ doctools/branches/0.4.x/doc/ext/autodoc.rst	Tue Jul  1 23:24:55 2008
@@ -136,6 +136,17 @@
    These work exactly like :dir:`autoclass` etc., but do not offer the options
    used for automatic member documentation.
 
+   .. note::
+
+      If you document decorated functions or methods, keep in mind that autodoc
+      retrieves its docstrings by importing the module and inspecting the
+      ``__doc__`` attribute of the given function or method.  That means that if
+      a decorator replaces the decorated function with another, it must copy the
+      original ``__doc__`` to the new function.
+
+      From Python 2.5, :func:`functools.wraps` can be used to create
+      well-behaved decorating functions.
+
 
 There are also new config values that you can set:
 


More information about the Python-checkins mailing list