summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-03-08 07:15:36 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-03-08 07:15:36 (GMT)
commit3e1dd3be4936fc1b1c0ad6ad6609f504b4e3e7a9 (patch)
tree20e1ac068d99722d96f26820b41119ff1fc9d69b /Doc
parentc8b6d1bd8c9dcd7fd69282ab65dded5c9a89af77 (diff)
downloadcpython-3e1dd3be4936fc1b1c0ad6ad6609f504b4e3e7a9.zip
cpython-3e1dd3be4936fc1b1c0ad6ad6609f504b4e3e7a9.tar.gz
cpython-3e1dd3be4936fc1b1c0ad6ad6609f504b4e3e7a9.tar.bz2
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.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libfunctional.tex8
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/lib/libfunctional.tex b/Doc/lib/libfunctional.tex
index fa8ef46..86b1483 100644
--- a/Doc/lib/libfunctional.tex
+++ b/Doc/lib/libfunctional.tex
@@ -44,6 +44,7 @@ the \function{int} function where the \var{base} argument defaults to
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 @@ positional arguments provided to a \class{partial} object call.
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.