lib/libsimplexmlrpc.tex \
lib/libdocxmlrpc.tex \
lib/libpyexpat.tex \
+ lib/libfunctools.tex \
lib/xmldom.tex \
lib/xmldomminidom.tex \
lib/xmldompulldom.tex \
% Functions, Functional, Generators and Iterators
% XXX intro functional
\input{libitertools}
-\input{libfunctional}
-\input{liboperator} % from runtime - better with itertools and functional
+\input{libfunctools}
+\input{liboperator} % from runtime - better with itertools and functools
% =============
-\section{\module{functional} ---
+\section{\module{functools} ---
Higher order functions and operations on callable objects.}
-\declaremodule{standard}{functional} % standard library, in Python
+\declaremodule{standard}{functools} % standard library, in Python
\moduleauthor{Peter Harris}{scav@blueyonder.co.uk}
\moduleauthor{Raymond Hettinger}{python@rcn.com}
\versionadded{2.5}
-The \module{functional} module is for higher-order functions: functions
+The \module{functools} module is for higher-order functions: functions
that act on or return other functions. In general, any callable object can
be treated as a function for the purposes of this module.
-The \module{functional} module defines the following function:
+The \module{functools} module defines the following function:
\begin{funcdesc}{partial}{func\optional{,*args}\optional{, **keywords}}
Return a new \class{partial} object which when called will behave like
-import functional
+import functools
import unittest
from test import test_support
from weakref import proxy
class TestPartial(unittest.TestCase):
- thetype = functional.partial
+ thetype = functools.partial
def test_basic_examples(self):
p = self.thetype(capture, 1, 2, a=10, b=20)
join = self.thetype(''.join)
self.assertEqual(join(data), '0123456789')
-class PartialSubclass(functional.partial):
+class PartialSubclass(functools.partial):
pass
class TestPartialSubclass(TestPartial):
(editors: check NEWS.help for information about editing NEWS using ReST.)
-What's New in Python 2.5 alpha 3?
+What's New in Python 2.5 beta 1?
=================================
-*Release date: XX-MAY-2006*
+*Release date: XX-JUN-2006*
Core and builtins
-----------------
Extension Modules
-----------------
+- Patch #1478788 (modified version): The functional extension module has
+ been renamed to _functools and a functools Python wrapper module added.
+ This provides a home for additional function related utilities that are
+ not specifically about functional programming. See PEP 309.
+
- Patch #1493701: performance enhancements for struct module.
- Patch #1490224: time.altzone is now set correctly on Cygwin.
- Calling Tk_Init twice is refused if the first call failed as that
may deadlock.
+
Library
-------
Documentation
-------------
+
+
What's New in Python 2.5 alpha 2?
=================================
#include "Python.h"
#include "structmember.h"
-/* Functional module written and maintained
+/* _functools module written and maintained
by Hye-Shik Chang <perky@FreeBSD.org>
with adaptations by Raymond Hettinger <python@rcn.com>
- Copyright (c) 2004, 2005 Python Software Foundation.
+ Copyright (c) 2004, 2005, 2006 Python Software Foundation.
All rights reserved.
*/
static PyTypeObject partial_type = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
- "functional.partial", /* tp_name */
+ "functools.partial", /* tp_name */
sizeof(partialobject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
/* module level code ********************************************************/
PyDoc_STRVAR(module_doc,
-"Tools for functional programming.");
+"Tools that operate on functions.");
static PyMethodDef module_methods[] = {
{NULL, NULL} /* sentinel */
};
PyMODINIT_FUNC
-initfunctional(void)
+init_functools(void)
{
int i;
PyObject *m;
NULL
};
- m = Py_InitModule3("functional", module_methods, module_doc);
+ m = Py_InitModule3("_functools", module_methods, module_doc);
if (m == NULL)
return;
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\Modules\functionalmodule.c\r
+SOURCE=..\..\Modules\_functoolsmodule.c\r
# End Source File\r
# Begin Source File\r
\r
extern void init_winreg(void);
extern void init_struct(void);
extern void initdatetime(void);
-extern void initfunctional(void);
+extern void init_functools(void);
extern void initzlib(void);
extern void init_multibytecodec(void);
{"_winreg", init_winreg},
{"_struct", init_struct},
{"datetime", initdatetime},
- {"functional", initfunctional},
+ {"_functools", init_functools},
{"xxsubtype", initxxsubtype},
{"zipimport", initzipimport},
RelativePath="..\Objects\funcobject.c">
</File>
<File
- RelativePath="..\Modules\functionalmodule.c">
- </File>
- <File
- RelativePath="..\Modules\functionalmodule.c">
+ RelativePath="..\Modules\_functoolsmodule.c">
</File>
<File
RelativePath="..\Python\future.c">
exts.append( Extension("_heapq", ["_heapqmodule.c"]) )
# operator.add() and similar goodies
exts.append( Extension('operator', ['operator.c']) )
- # functional
- exts.append( Extension("functional", ["functionalmodule.c"]) )
+ # _functools
+ exts.append( Extension("_functools", ["_functoolsmodule.c"]) )
# Python C API test module
exts.append( Extension('_testcapi', ['_testcapimodule.c']) )
# profilers (_lsprof is for cProfile.py)