diff Doc/lib/libfunctional.tex @ 34704:3098efe42a0f legacy-trunk

Make functional.partial() more closely match the spec by emulating some useful features of regular functions: * Made weak referencable. * Allow attribute access so a user can set __name__, __doc__, etc.
author Raymond Hettinger <python@rcn.com>
date Tue, 08 Mar 2005 07:15:36 +0000
parents b4315e67edf5
children fc442c2eb0cf
line wrap: on
line diff
--- a/Doc/lib/libfunctional.tex	Tue Mar 08 06:14:50 2005 +0000
+++ b/Doc/lib/libfunctional.tex	Tue Mar 08 07:15:36 2005 +0000
@@ -44,6 +44,7 @@
 two:
   \begin{verbatim}
         >>> basetwo = partial(int, base=2)
+        >>> basetwo.__doc__('Convert base 2 string to an int.')
         >>> basetwo('10010')
         18
   \end{verbatim}
@@ -71,3 +72,10 @@
 The keyword arguments that will be supplied when the \class{partial} object
 is called.
 \end{memberdesc}
+
+\class{partial} objects are like \class{function} objects in that they are
+callable, weak referencable, and can have attributes.  There are some
+important differences.  For instance, the \member{__name__} and
+\member{__doc__} attributes are not created automatically.  Also,
+\class{partial} objects defined in classes behave like static methods and
+do not transform into bound methods during instance attribute look-up.