blob: c1ff3748a66c4fab514f4393c3209f3de713a53b [file] [log] [blame]
Fred Drake2db76802004-12-01 05:05:47 +00001\documentclass{howto}
2\usepackage{distutils}
3% $Id$
4
Fred Drake2db76802004-12-01 05:05:47 +00005
6\title{What's New in Python 2.5}
7\release{0.0}
Andrew M. Kuchling92e24952004-12-03 13:54:09 +00008\author{A.M. Kuchling}
9\authoraddress{\email{amk@amk.ca}}
Fred Drake2db76802004-12-01 05:05:47 +000010
11\begin{document}
12\maketitle
13\tableofcontents
14
15This article explains the new features in Python 2.5. No release date
Andrew M. Kuchling92e24952004-12-03 13:54:09 +000016for Python 2.5 has been set; it will probably be released in late 2005.
Fred Drake2db76802004-12-01 05:05:47 +000017
18% Compare with previous release in 2 - 3 sentences here.
19
20This article doesn't attempt to provide a complete specification of
21the new features, but instead provides a convenient overview. For
22full details, you should refer to the documentation for Python 2.5.
23% add hyperlink when the documentation becomes available online.
24If you want to understand the complete implementation and design
25rationale, refer to the PEP for a particular new feature.
26
27
28%======================================================================
Andrew M. Kuchling3e41b052005-03-01 00:53:46 +000029\section{PEP 309: Partial Function Application}
Fred Drake2db76802004-12-01 05:05:47 +000030
Andrew M. Kuchling3e41b052005-03-01 00:53:46 +000031XXX describe this PEP.
Fred Drake2db76802004-12-01 05:05:47 +000032
33
34%======================================================================
35\section{Other Language Changes}
36
37Here are all of the changes that Python 2.5 makes to the core Python
38language.
39
40\begin{itemize}
Andrew M. Kuchling1cae3f52004-12-03 14:57:21 +000041
42\item The \function{min()} and \function{max()} built-in functions
43gained a \code{key} keyword argument analogous to the \code{key}
44argument for \function{sort()}. This argument supplies a function
45that takes a single argument and is called for every value in the list;
46\function{min()}/\function{max()} will return the element with the
47smallest/largest return value from this function.
48For example, to find the longest string in a list, you can do:
49
50\begin{verbatim}
51L = ['medium', 'longest', 'short']
52# Prints 'longest'
53print max(L, key=len)
54# Prints 'short', because lexicographically 'short' has the largest value
55print max(L)
56\end{verbatim}
57
Andrew M. Kuchling3e41b052005-03-01 00:53:46 +000058% XXX also supported by heapq.nsmallest() and heapq.nlargest().
59
Andrew M. Kuchling1cae3f52004-12-03 14:57:21 +000060(Contributed by Steven Bethard and Raymond Hettinger.)
Fred Drake2db76802004-12-01 05:05:47 +000061
62\end{itemize}
63
64
65%======================================================================
66\subsection{Optimizations}
67
68\begin{itemize}
69
70\item Optimizations should be described here.
71
72\end{itemize}
73
74The net result of the 2.5 optimizations is that Python 2.5 runs the
Andrew M. Kuchling92e24952004-12-03 13:54:09 +000075pystone benchmark around XX\% faster than Python 2.4.
Fred Drake2db76802004-12-01 05:05:47 +000076
77
78%======================================================================
79\section{New, Improved, and Deprecated Modules}
80
81As usual, Python's standard library received a number of enhancements and
82bug fixes. Here's a partial list of the most notable changes, sorted
83alphabetically by module name. Consult the
84\file{Misc/NEWS} file in the source tree for a more
85complete list of changes, or look through the CVS logs for all the
86details.
87
88\begin{itemize}
89
Andrew M. Kuchling3e41b052005-03-01 00:53:46 +000090% the cPickle module no longer accepts the deprecated None option in the
91% args tuple returned by __reduce__().
92
93% csv module improvements
94
95% datetime.datetime() now has a strptime class method which can be used to
96% create datetime object using a string and format.
97
98% itertools.islice() now accepts None for the start and step arguments.
99
100\item New module: \module{spwd} provides functions for accessing the
101shadow password database on systems that support it.
102% XXX give example
103
104% XXX os.stat_float_times is now True
105
106% os.{SEEK_SET, SEEK_CUR, SEEK_END} have been added for convenience.
Fred Drake2db76802004-12-01 05:05:47 +0000107
108\end{itemize}
109
110
111%======================================================================
112% whole new modules get described in \subsections here
113
114
115% ======================================================================
116\section{Build and C API Changes}
117
118Changes to Python's build process and to the C API include:
119
120\begin{itemize}
121
Andrew M. Kuchling2238fc62004-12-03 15:16:40 +0000122\item The \cfunction{PyRange_New()} function was removed. It was never documented,
123never used in the core code, and had dangerously lax error checking.
Fred Drake2db76802004-12-01 05:05:47 +0000124
125\end{itemize}
126
127
128%======================================================================
129\subsection{Port-Specific Changes}
130
131Platform-specific changes go here.
132
133
134%======================================================================
135\section{Other Changes and Fixes \label{section-other}}
136
137As usual, there were a bunch of other improvements and bugfixes
138scattered throughout the source tree. A search through the CVS change
139logs finds there were XXX patches applied and YYY bugs fixed between
Andrew M. Kuchling92e24952004-12-03 13:54:09 +0000140Python 2.4 and 2.5. Both figures are likely to be underestimates.
Fred Drake2db76802004-12-01 05:05:47 +0000141
142Some of the more notable changes are:
143
144\begin{itemize}
145
146\item Details go here.
147
148\end{itemize}
149
150
151%======================================================================
152\section{Porting to Python 2.5}
153
154This section lists previously described changes that may require
155changes to your code:
156
157\begin{itemize}
158
Andrew M. Kuchling3e41b052005-03-01 00:53:46 +0000159\item Some old deprecated modules (\module{statcache}, \module{tzparse},
160 \module{whrandom}) have been moved to \file{Lib/lib-old}.
161% XXX note how to get them back
162
163% the pickle module no longer uses the deprecated bin parameter.
Fred Drake2db76802004-12-01 05:05:47 +0000164
165\end{itemize}
166
167
168%======================================================================
169\section{Acknowledgements \label{acks}}
170
171The author would like to thank the following people for offering
172suggestions, corrections and assistance with various drafts of this
173article: .
174
175\end{document}