diff options
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/whatsnew25.tex | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/Doc/whatsnew/whatsnew25.tex b/Doc/whatsnew/whatsnew25.tex index 3006624..5bee789 100644 --- a/Doc/whatsnew/whatsnew25.tex +++ b/Doc/whatsnew/whatsnew25.tex @@ -125,7 +125,7 @@ Wouters.} %====================================================================== \section{PEP 309: Partial Function Application\label{pep-309}} -The \module{functional} module is intended to contain tools for +The \module{functools} module is intended to contain tools for functional-style programming. Currently it only contains a \class{partial()} function, but new functions will probably be added in future versions of Python. @@ -136,7 +136,7 @@ parameters filled in. Consider a Python function \code{f(a, b, c)}; you could create a new function \code{g(b, c)} that was equivalent to \code{f(1, b, c)}. This is called ``partial function application'', and is provided by the \class{partial} class in the new -\module{functional} module. +\module{functools} module. The constructor for \class{partial} takes the arguments \code{(\var{function}, \var{arg1}, \var{arg2}, ... @@ -147,18 +147,18 @@ with the filled-in arguments. Here's a small but realistic example: \begin{verbatim} -import functional +import functools def log (message, subsystem): "Write the contents of 'message' to the specified subsystem." print '%s: %s' % (subsystem, message) ... -server_log = functional.partial(log, subsystem='server') +server_log = functools.partial(log, subsystem='server') server_log('Unable to open socket') \end{verbatim} -Here's another example, from a program that uses PyGTk. Here a +Here's another example, from a program that uses PyGTK. Here a context-sensitive pop-up menu is being constructed dynamically. The callback provided for the menu option is a partially applied version of the \method{open_item()} method, where the first argument has been @@ -170,7 +170,7 @@ class Application: def open_item(self, path): ... def init (self): - open_func = functional.partial(self.open_item, item_path) + open_func = functools.partial(self.open_item, item_path) popup_menu.append( ("Open", open_func, 1) ) \end{verbatim} @@ -1508,6 +1508,14 @@ therefore now works on non-{\UNIX} platforms. (Patch from Robert Kiendl.) % Patch #1472854 +\item The \module{SimpleXMLRPCServer} and \module{DocXMLRPCServer} +classes now have a \member{rpc_paths} attribute that constrains +XML-RPC operations to a limited set of URL paths; the default is +to allow only \code{'/'} and \code{'/RPC2'}. Setting +\member{rpc_paths} to \code{None} or an empty tuple disables +this path checking. +% Bug #1473048 + \item The \module{socket} module now supports \constant{AF_NETLINK} sockets on Linux, thanks to a patch from Philippe Biondi. Netlink sockets are a Linux-specific mechanism for communications @@ -2163,6 +2171,13 @@ longer accept a return value of \code{None} from the arguments instead. The modules also no longer accept the deprecated \var{bin} keyword parameter. +\item Library: The \module{SimpleXMLRPCServer} and \module{DocXMLRPCServer} +classes now have a \member{rpc_paths} attribute that constrains +XML-RPC operations to a limited set of URL paths; the default is +to allow only \code{'/'} and \code{'/RPC2'}. Setting +\member{rpc_paths} to \code{None} or an empty tuple disables +this path checking. + \item C API: Many functions now use \ctype{Py_ssize_t} instead of \ctype{int} to allow processing more data on 64-bit machines. Extension code may need to make the same change to avoid |