[Python-checkins] python/dist/src/Doc/lib libfunctional.tex, 1.2,
1.3
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Tue Mar 8 08:15:41 CET 2005
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2858
Modified Files:
libfunctional.tex
Log Message:
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.
Index: libfunctional.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfunctional.tex,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- libfunctional.tex 2 Mar 2005 15:10:38 -0000 1.2
+++ libfunctional.tex 8 Mar 2005 07:15:36 -0000 1.3
@@ -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.
More information about the Python-checkins
mailing list