Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 1 | \documentclass{howto} |
| 2 | \usepackage{distutils} |
| 3 | % $Id$ |
| 4 | |
| 5 | \title{What's New in Python 2.4} |
| 6 | \release{0.0} |
| 7 | \author{A.M.\ Kuchling} |
| 8 | \authoraddress{\email{amk@amk.ca}} |
| 9 | |
| 10 | \begin{document} |
| 11 | \maketitle |
| 12 | \tableofcontents |
| 13 | |
| 14 | This article explains the new features in Python 2.4. No release date |
Raymond Hettinger | d446230 | 2003-11-26 17:52:45 +0000 | [diff] [blame] | 15 | for Python 2.4 has been set; expect that this will happen mid-2004. |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 16 | |
| 17 | While Python 2.3 was primarily a library development release, Python |
| 18 | 2.4 may extend the core language and interpreter in |
| 19 | as-yet-undetermined ways. |
| 20 | |
| 21 | This article doesn't attempt to provide a complete specification of |
| 22 | the new features, but instead provides a convenient overview. For |
| 23 | full details, you should refer to the documentation for Python 2.4. |
| 24 | % add hyperlink when the documentation becomes available online. |
| 25 | If you want to understand the complete implementation and design |
| 26 | rationale, refer to the PEP for a particular new feature. |
| 27 | |
Raymond Hettinger | 7e0282f | 2003-11-24 07:14:54 +0000 | [diff] [blame] | 28 | %====================================================================== |
| 29 | \section{PEP 218: Built-In Set Objects} |
| 30 | |
| 31 | Two new built-in types, \function{set(iterable)} and |
| 32 | \function{frozenset(iterable)} provide high speed data types for |
| 33 | membership testing, for eliminating duplicates from sequences, and |
| 34 | for mathematical operations like unions, intersections, differences, |
| 35 | and symmetric differences. |
| 36 | |
| 37 | \begin{verbatim} |
| 38 | >>> a = set('abracadabra') # form a set from a string |
| 39 | >>> 'z' in a # fast membership testing |
| 40 | False |
| 41 | >>> a # unique letters in a |
| 42 | set(['a', 'r', 'b', 'c', 'd']) |
| 43 | >>> ''.join(a) # convert back into a string |
| 44 | 'arbcd' |
Raymond Hettinger | d446230 | 2003-11-26 17:52:45 +0000 | [diff] [blame] | 45 | |
Raymond Hettinger | 7e0282f | 2003-11-24 07:14:54 +0000 | [diff] [blame] | 46 | >>> b = set('alacazam') # form a second set |
| 47 | >>> a - b # letters in a but not in b |
| 48 | set(['r', 'd', 'b']) |
| 49 | >>> a | b # letters in either a or b |
| 50 | set(['a', 'c', 'r', 'd', 'b', 'm', 'z', 'l']) |
| 51 | >>> a & b # letters in both a and b |
| 52 | set(['a', 'c']) |
| 53 | >>> a ^ b # letters in a or b but not both |
| 54 | set(['r', 'd', 'b', 'm', 'z', 'l']) |
Raymond Hettinger | d446230 | 2003-11-26 17:52:45 +0000 | [diff] [blame] | 55 | |
Raymond Hettinger | 7e0282f | 2003-11-24 07:14:54 +0000 | [diff] [blame] | 56 | >>> a.add('z') # add a new element |
| 57 | >>> a.update('wxy') # add multiple new elements |
| 58 | >>> a |
| 59 | set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'x', 'z']) |
| 60 | >>> a.remove('x') # take one element out |
| 61 | >>> a |
| 62 | set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z']) |
| 63 | \end{verbatim} |
| 64 | |
| 65 | The type \function{frozenset()} is an immutable version of \function{set()}. |
| 66 | Since it is immutable and hashable, it may be used as a dictionary key or |
| 67 | as a member of another set. Accordingly, it does not have methods |
| 68 | like \method{add()} and \method{remove()} which could alter its contents. |
| 69 | |
| 70 | \begin{seealso} |
| 71 | \seepep{218}{Adding a Built-In Set Object Type}{Originally proposed by |
| 72 | Greg Wilson and ultimately implemented by Raymond Hettinger.} |
| 73 | \end{seealso} |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 74 | |
| 75 | %====================================================================== |
Andrew M. Kuchling | 1a42025 | 2003-11-08 15:58:49 +0000 | [diff] [blame] | 76 | \section{PEP 322: Reverse Iteration} |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 77 | |
Andrew M. Kuchling | 1a42025 | 2003-11-08 15:58:49 +0000 | [diff] [blame] | 78 | A new built-in function, \function{reversed(seq)}, takes a sequence |
| 79 | and returns an iterator that returns the elements of the sequence |
| 80 | in reverse order. |
| 81 | |
| 82 | \begin{verbatim} |
Raymond Hettinger | bc3cba2 | 2003-11-12 16:39:30 +0000 | [diff] [blame] | 83 | >>> for i in reversed(xrange(1,4)): |
Andrew M. Kuchling | 1a42025 | 2003-11-08 15:58:49 +0000 | [diff] [blame] | 84 | ... print i |
| 85 | ... |
| 86 | 3 |
| 87 | 2 |
| 88 | 1 |
| 89 | \end{verbatim} |
| 90 | |
Raymond Hettinger | bc3cba2 | 2003-11-12 16:39:30 +0000 | [diff] [blame] | 91 | Compared to extended slicing, \code{range(1,4)[::-1]}, \function{reversed()} |
| 92 | is easier to read, runs faster, and uses substantially less memory. |
| 93 | |
Andrew M. Kuchling | 1a42025 | 2003-11-08 15:58:49 +0000 | [diff] [blame] | 94 | Note that \function{reversed()} only accepts sequences, not arbitrary |
Raymond Hettinger | bc3cba2 | 2003-11-12 16:39:30 +0000 | [diff] [blame] | 95 | iterators. If you want to reverse an iterator, first convert it to |
| 96 | a list with \function{list()}. |
Andrew M. Kuchling | 1a42025 | 2003-11-08 15:58:49 +0000 | [diff] [blame] | 97 | |
| 98 | \begin{verbatim} |
| 99 | >>> input = open('/etc/passwd', 'r') |
| 100 | >>> for line in reversed(list(input)): |
| 101 | ... print line |
| 102 | ... |
| 103 | root:*:0:0:System Administrator:/var/root:/bin/tcsh |
| 104 | ... |
| 105 | \end{verbatim} |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 106 | |
Andrew M. Kuchling | f7a6b67 | 2003-11-08 16:05:37 +0000 | [diff] [blame] | 107 | \begin{seealso} |
| 108 | \seepep{322}{Reverse Iteration}{Written and implemented by Raymond Hettinger.} |
| 109 | |
| 110 | \end{seealso} |
| 111 | |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 112 | |
| 113 | %====================================================================== |
| 114 | \section{Other Language Changes} |
| 115 | |
| 116 | Here are all of the changes that Python 2.4 makes to the core Python |
| 117 | language. |
| 118 | |
| 119 | \begin{itemize} |
Raymond Hettinger | d446230 | 2003-11-26 17:52:45 +0000 | [diff] [blame] | 120 | |
| 121 | \item The string methods, \method{ljust()}, \method{rjust()}, and |
Andrew M. Kuchling | 6708756 | 2003-11-26 18:03:48 +0000 | [diff] [blame] | 122 | \method{center()} now take an optional argument for specifying a |
Raymond Hettinger | d446230 | 2003-11-26 17:52:45 +0000 | [diff] [blame] | 123 | fill character other than a space. |
| 124 | |
Andrew M. Kuchling | 2fb4d51 | 2003-10-21 12:31:16 +0000 | [diff] [blame] | 125 | \item The \method{sort()} method of lists gained three keyword |
| 126 | arguments, \var{cmp}, \var{key}, and \var{reverse}. These arguments |
| 127 | make some common usages of \method{sort()} simpler. All are optional. |
| 128 | |
| 129 | \var{cmp} is the same as the previous single argument to |
| 130 | \method{sort()}; if provided, the value should be a comparison |
| 131 | function that takes two arguments and returns -1, 0, or +1 depending |
| 132 | on how the arguments compare. |
| 133 | |
| 134 | \var{key} should be a single-argument function that takes a list |
| 135 | element and returns a comparison key for the element. The list is |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 136 | then sorted using the comparison keys. The following example sorts a |
| 137 | list case-insensitively: |
Andrew M. Kuchling | 2fb4d51 | 2003-10-21 12:31:16 +0000 | [diff] [blame] | 138 | |
| 139 | \begin{verbatim} |
| 140 | >>> L = ['A', 'b', 'c', 'D'] |
| 141 | >>> L.sort() # Case-sensitive sort |
| 142 | >>> L |
| 143 | ['A', 'D', 'b', 'c'] |
| 144 | >>> L.sort(key=lambda x: x.lower()) |
| 145 | >>> L |
| 146 | ['A', 'b', 'c', 'D'] |
| 147 | >>> L.sort(cmp=lambda x,y: cmp(x.lower(), y.lower())) |
| 148 | >>> L |
| 149 | ['A', 'b', 'c', 'D'] |
| 150 | \end{verbatim} |
| 151 | |
| 152 | The last example, which uses the \var{cmp} parameter, is the old way |
| 153 | to perform a case-insensitive sort. It works, but is slower than |
| 154 | using a \var{key} parameter. Using \var{key} results in calling the |
| 155 | \method{lower()} method once for each element in the list while using |
| 156 | \var{cmp} will call the method twice for each comparison. |
| 157 | |
Andrew M. Kuchling | 981a918 | 2003-11-13 21:33:26 +0000 | [diff] [blame] | 158 | For simple key functions and comparison functions, it is often |
| 159 | possible to avoid a \keyword{lambda} expression by using an unbound |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 160 | method instead. For example, the above case-insensitive sort is best |
| 161 | coded as: |
| 162 | |
| 163 | \begin{verbatim} |
| 164 | >>> L.sort(key=str.lower) |
| 165 | >>> L |
| 166 | ['A', 'b', 'c', 'D'] |
| 167 | \end{verbatim} |
| 168 | |
Andrew M. Kuchling | 2fb4d51 | 2003-10-21 12:31:16 +0000 | [diff] [blame] | 169 | The \var{reverse} parameter should have a Boolean value. If the value is |
| 170 | \constant{True}, the list will be sorted into reverse order. Instead |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 171 | of \code{L.sort(lambda x,y: cmp(y.score, x.score))}, you can now write: |
| 172 | \code{L.sort(key = lambda x: x.score, reverse=True)}. |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 173 | |
Andrew M. Kuchling | 981a918 | 2003-11-13 21:33:26 +0000 | [diff] [blame] | 174 | The results of sorting are now guaranteed to be stable. This means |
| 175 | that two entries with equal keys will be returned in the same order as |
| 176 | they were input. For example, you can sort a list of people by name, |
| 177 | and then sort the list by age, resulting in a list sorted by age where |
| 178 | people with the same age are in name-sorted order. |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 179 | |
| 180 | \item The list type gained a \method{sorted(iterable)} method that works |
| 181 | like the in-place \method{sort()} method but has been made suitable for |
| 182 | use in expressions. The differences are: |
| 183 | \begin{itemize} |
Raymond Hettinger | 7d1dd04 | 2003-11-12 16:42:10 +0000 | [diff] [blame] | 184 | \item the input may be any iterable; |
| 185 | \item a newly formed copy is sorted, leaving the original intact; and |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 186 | \item the expression returns the new sorted copy |
| 187 | \end{itemize} |
Andrew M. Kuchling | 1a42025 | 2003-11-08 15:58:49 +0000 | [diff] [blame] | 188 | |
| 189 | \begin{verbatim} |
| 190 | >>> L = [9,7,8,3,2,4,1,6,5] |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 191 | >>> [10+i for i in list.sorted(L)] # usable in a list comprehension |
| 192 | [11, 12, 13, 14, 15, 16, 17, 18, 19] |
| 193 | >>> L = [9,7,8,3,2,4,1,6,5] # original is left unchanged |
| 194 | [9,7,8,3,2,4,1,6,5] |
Raymond Hettinger | d446230 | 2003-11-26 17:52:45 +0000 | [diff] [blame] | 195 | |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 196 | >>> list.sorted('Monte Python') # any iterable may be an input |
| 197 | [' ', 'M', 'P', 'e', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y'] |
Raymond Hettinger | d446230 | 2003-11-26 17:52:45 +0000 | [diff] [blame] | 198 | |
| 199 | >>> # List the contents of a dict sorted by key values |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 200 | >>> colormap = dict(red=1, blue=2, green=3, black=4, yellow=5) |
| 201 | >>> for k, v in list.sorted(colormap.iteritems()): |
| 202 | ... print k, v |
| 203 | ... |
| 204 | black 4 |
| 205 | blue 2 |
| 206 | green 3 |
| 207 | red 1 |
| 208 | yellow 5 |
| 209 | |
Andrew M. Kuchling | 1a42025 | 2003-11-08 15:58:49 +0000 | [diff] [blame] | 210 | \end{verbatim} |
| 211 | |
Andrew M. Kuchling | 1a42025 | 2003-11-08 15:58:49 +0000 | [diff] [blame] | 212 | |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 213 | \item The \function{zip()} built-in function and \function{itertools.izip()} |
Andrew M. Kuchling | 6708756 | 2003-11-26 18:03:48 +0000 | [diff] [blame] | 214 | now return an empty list instead of raising a \exception{TypeError} |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 215 | exception if called with no arguments. This makes the functions more |
| 216 | suitable for use with variable length argument lists: |
| 217 | |
| 218 | \begin{verbatim} |
| 219 | >>> def transpose(array): |
| 220 | ... return zip(*array) |
| 221 | ... |
| 222 | >>> transpose([(1,2,3), (4,5,6)]) |
| 223 | [(1, 4), (2, 5), (3, 6)] |
| 224 | >>> transpose([]) |
| 225 | [] |
| 226 | \end{verbatim} |
Andrew M. Kuchling | 6aedcfc | 2003-10-21 12:48:23 +0000 | [diff] [blame] | 227 | |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 228 | \end{itemize} |
| 229 | |
| 230 | |
| 231 | %====================================================================== |
| 232 | \subsection{Optimizations} |
| 233 | |
| 234 | \begin{itemize} |
| 235 | |
| 236 | \item Optimizations should be described here. |
| 237 | |
| 238 | \end{itemize} |
| 239 | |
| 240 | The net result of the 2.4 optimizations is that Python 2.4 runs the |
| 241 | pystone benchmark around XX\% faster than Python 2.3 and YY\% faster |
| 242 | than Python 2.2. |
| 243 | |
| 244 | |
| 245 | %====================================================================== |
| 246 | \section{New, Improved, and Deprecated Modules} |
| 247 | |
| 248 | As usual, Python's standard library received a number of enhancements and |
| 249 | bug fixes. Here's a partial list of the most notable changes, sorted |
| 250 | alphabetically by module name. Consult the |
| 251 | \file{Misc/NEWS} file in the source tree for a more |
| 252 | complete list of changes, or look through the CVS logs for all the |
| 253 | details. |
| 254 | |
| 255 | \begin{itemize} |
| 256 | |
Andrew M. Kuchling | 69f31eb | 2003-08-13 23:11:04 +0000 | [diff] [blame] | 257 | \item The \module{curses} modules now supports the ncurses extension |
| 258 | \function{use_default_colors()}. On platforms where the terminal |
| 259 | supports transparency, this makes it possible to use a transparent background. |
| 260 | (Contributed by J\"org Lehmann.) |
Andrew M. Kuchling | 6aedcfc | 2003-10-21 12:48:23 +0000 | [diff] [blame] | 261 | |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 262 | \item The \module{heapq} module has been converted to C. The resulting |
| 263 | ten-fold improvement in speed makes the module suitable for handling |
| 264 | high volumes of data. |
Andrew M. Kuchling | 1a42025 | 2003-11-08 15:58:49 +0000 | [diff] [blame] | 265 | |
Andrew M. Kuchling | dff9dbd | 2003-11-20 22:22:19 +0000 | [diff] [blame] | 266 | \item The \module{imaplib} module now supports IMAP's THREAD command. |
| 267 | (Contributed by Yves Dionne.) |
| 268 | |
Andrew M. Kuchling | ad80955 | 2003-12-06 23:19:23 +0000 | [diff] [blame] | 269 | \item The \module{itertools} module gained a |
| 270 | \function{groupby(\var{iterable}\optional{, \var{func}})} function, |
| 271 | inspired by the GROUP BY clause from SQL. |
| 272 | \var{iterable} returns a succession of elements, and the optional |
| 273 | \var{func} is a function that takes an element and returns a key |
| 274 | value; if omitted, the key is simply the element itself. |
| 275 | \function{groupby()} then groups the elements into subsequences |
| 276 | which have matching values of the key, and returns a series of 2-tuples |
| 277 | containing the key value and an iterator over the subsequence. |
| 278 | |
| 279 | Here's an example. The \var{key} function simply returns whether a |
| 280 | number is even or odd, so the result of \function{groupby()} is to |
| 281 | return consecutive runs of odd or even numbers. |
| 282 | |
| 283 | \begin{verbatim} |
| 284 | >>> import itertools |
| 285 | >>> L = [2,4,6, 7,8,9,11, 12, 14] |
| 286 | >>> for key_val, it in itertools.groupby(L, lambda x: x % 2): |
| 287 | ... print key_val, list(it) |
| 288 | ... |
| 289 | 0 [2, 4, 6] |
| 290 | 1 [7] |
| 291 | 0 [8] |
| 292 | 1 [9, 11] |
| 293 | 0 [12, 14] |
| 294 | >>> |
| 295 | \end{verbatim} |
| 296 | |
Raymond Hettinger | feb78c9 | 2003-12-12 13:13:47 +0000 | [diff] [blame] | 297 | Like its SQL counterpart, \function{groupby()} is typically used with |
| 298 | sorted input. The logic for \function{groupby()} is similar to the |
| 299 | \UNIX{} \code{uniq} filter which makes it handy for eliminating, |
| 300 | counting, or identifying duplicate elements: |
| 301 | |
| 302 | \begin{verbatim} |
| 303 | >>> word = 'abracadabra' |
Andrew M. Kuchling | 4612bc5 | 2003-12-16 20:59:37 +0000 | [diff] [blame^] | 304 | >>> word = list.sorted(word) # Turn string into sorted list of letters |
| 305 | >>> word |
| 306 | ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r'] |
| 307 | >>> [k for k, g in groupby(word)] # List the various group keys |
Raymond Hettinger | feb78c9 | 2003-12-12 13:13:47 +0000 | [diff] [blame] | 308 | ['a', 'b', 'c', 'd', 'r'] |
Andrew M. Kuchling | 4612bc5 | 2003-12-16 20:59:37 +0000 | [diff] [blame^] | 309 | >>> [(k, len(list(g))) for k, g in groupby(word)] # List key and group length |
Raymond Hettinger | feb78c9 | 2003-12-12 13:13:47 +0000 | [diff] [blame] | 310 | [('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)] |
Andrew M. Kuchling | 4612bc5 | 2003-12-16 20:59:37 +0000 | [diff] [blame^] | 311 | >>> [k for k, g in groupby(word) if len(list(g)) > 1] # All groups of size >1 |
Raymond Hettinger | feb78c9 | 2003-12-12 13:13:47 +0000 | [diff] [blame] | 312 | ['a', 'b', 'r'] |
| 313 | \end{verbatim} |
| 314 | |
Andrew M. Kuchling | dff9dbd | 2003-11-20 22:22:19 +0000 | [diff] [blame] | 315 | \item A new \function{getsid()} function was added to the |
| 316 | \module{posix} module that underlies the \module{os} module. |
| 317 | (Contributed by J. Raynor.) |
| 318 | |
Andrew M. Kuchling | 6aedcfc | 2003-10-21 12:48:23 +0000 | [diff] [blame] | 319 | \item The \module{random} module has a new method called \method{getrandbits(N)} |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 320 | which returns an N-bit long integer. This method supports the existing |
| 321 | \method{randrange()} method, making it possible to efficiently generate |
| 322 | arbitrarily large random numbers (suitable for prime number generation in |
| 323 | RSA applications). |
Andrew M. Kuchling | 6aedcfc | 2003-10-21 12:48:23 +0000 | [diff] [blame] | 324 | |
| 325 | \item The regular expression language accepted by the \module{re} module |
| 326 | was extended with simple conditional expressions, written as |
| 327 | \code{(?(\var{group})\var{A}|\var{B})}. \var{group} is either a |
| 328 | numeric group ID or a group name defined with \code{(?P<group>...)} |
| 329 | earlier in the expression. If the specified group matched, the |
| 330 | regular expression pattern \var{A} will be tested against the string; if |
| 331 | the group didn't match, the pattern \var{B} will be used instead. |
Andrew M. Kuchling | 69f31eb | 2003-08-13 23:11:04 +0000 | [diff] [blame] | 332 | |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 333 | \end{itemize} |
| 334 | |
| 335 | |
| 336 | %====================================================================== |
| 337 | % whole new modules get described in \subsections here |
| 338 | |
| 339 | |
| 340 | % ====================================================================== |
| 341 | \section{Build and C API Changes} |
| 342 | |
| 343 | Changes to Python's build process and to the C API include: |
| 344 | |
| 345 | \begin{itemize} |
| 346 | |
Andrew M. Kuchling | 6aedcfc | 2003-10-21 12:48:23 +0000 | [diff] [blame] | 347 | \item Three new convenience macros were added for common return |
| 348 | values from extension functions: \csimplemacro{Py_RETURN_NONE}, |
| 349 | \csimplemacro{Py_RETURN_TRUE}, and \csimplemacro{Py_RETURN_FALSE}. |
| 350 | |
| 351 | \item A new function, \cfunction{PyTuple_Pack(N, obj1, obj2, ..., |
| 352 | objN)}, constructs tuples from a variable length argument list of |
| 353 | Python objects. |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 354 | |
Andrew M. Kuchling | 2ce1d47 | 2003-11-26 18:05:26 +0000 | [diff] [blame] | 355 | \item A new function, \cfunction{PyDict_Contains(d, k)}, implements |
| 356 | fast dictionary lookups without masking exceptions raised during the |
| 357 | look-up process. |
Raymond Hettinger | d446230 | 2003-11-26 17:52:45 +0000 | [diff] [blame] | 358 | |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 359 | \end{itemize} |
| 360 | |
| 361 | |
| 362 | %====================================================================== |
| 363 | \subsection{Port-Specific Changes} |
| 364 | |
| 365 | Platform-specific changes go here. |
| 366 | |
| 367 | |
| 368 | %====================================================================== |
| 369 | \section{Other Changes and Fixes \label{section-other}} |
| 370 | |
| 371 | As usual, there were a bunch of other improvements and bugfixes |
| 372 | scattered throughout the source tree. A search through the CVS change |
| 373 | logs finds there were XXX patches applied and YYY bugs fixed between |
| 374 | Python 2.3 and 2.4. Both figures are likely to be underestimates. |
| 375 | |
| 376 | Some of the more notable changes are: |
| 377 | |
| 378 | \begin{itemize} |
| 379 | |
| 380 | \item Details go here. |
| 381 | |
| 382 | \end{itemize} |
| 383 | |
| 384 | |
| 385 | %====================================================================== |
| 386 | \section{Porting to Python 2.4} |
| 387 | |
| 388 | This section lists previously described changes that may require |
| 389 | changes to your code: |
| 390 | |
| 391 | \begin{itemize} |
| 392 | |
Raymond Hettinger | 607c00f | 2003-11-12 16:27:50 +0000 | [diff] [blame] | 393 | \item The \function{zip()} built-in function and \function{itertools.izip()} |
| 394 | now return an empty list instead of raising a \exception{TypeError} |
| 395 | exception if called with no arguments. |
Andrew M. Kuchling | 6aedcfc | 2003-10-21 12:48:23 +0000 | [diff] [blame] | 396 | |
| 397 | \item \function{dircache.listdir()} now passes exceptions to the caller |
| 398 | instead of returning empty lists. |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 399 | |
| 400 | \end{itemize} |
| 401 | |
| 402 | |
| 403 | %====================================================================== |
| 404 | \section{Acknowledgements \label{acks}} |
| 405 | |
| 406 | The author would like to thank the following people for offering |
| 407 | suggestions, corrections and assistance with various drafts of this |
Andrew M. Kuchling | 981a918 | 2003-11-13 21:33:26 +0000 | [diff] [blame] | 408 | article: Raymond Hettinger. |
Fred Drake | ed0fa3d | 2003-07-30 19:14:09 +0000 | [diff] [blame] | 409 | |
| 410 | \end{document} |