Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 1 | \documentclass{howto} |
| 2 | |
| 3 | % $Id$ |
| 4 | |
| 5 | \title{What's New in Python 2.2} |
Andrew M. Kuchling | ab01087 | 2001-07-19 14:59:53 +0000 | [diff] [blame] | 6 | \release{0.04} |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 7 | \author{A.M. Kuchling} |
Andrew M. Kuchling | 7bf8277 | 2001-07-11 18:54:26 +0000 | [diff] [blame] | 8 | \authoraddress{\email{akuchlin@mems-exchange.org}} |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 9 | \begin{document} |
| 10 | \maketitle\tableofcontents |
| 11 | |
| 12 | \section{Introduction} |
| 13 | |
| 14 | {\large This document is a draft, and is subject to change until the |
| 15 | final version of Python 2.2 is released. Currently it's not up to |
| 16 | date at all. Please send any comments, bug reports, or questions, no |
Andrew M. Kuchling | 7bf8277 | 2001-07-11 18:54:26 +0000 | [diff] [blame] | 17 | matter how minor, to \email{akuchlin@mems-exchange.org}. } |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 18 | |
Andrew M. Kuchling | 7bf8277 | 2001-07-11 18:54:26 +0000 | [diff] [blame] | 19 | This article explains the new features in Python 2.2. Python 2.2 |
| 20 | includes some significant changes that go far toward cleaning up the |
| 21 | language's darkest corners, and some exciting new features. |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 22 | |
| 23 | This article doesn't attempt to provide a complete specification for |
| 24 | the new features, but instead provides a convenient overview of the |
| 25 | new features. For full details, you should refer to 2.2 documentation |
Fred Drake | 0d00254 | 2001-07-17 13:55:33 +0000 | [diff] [blame] | 26 | such as the |
| 27 | \citetitle[http://python.sourceforge.net/devel-docs/lib/lib.html]{Python |
| 28 | Library Reference} and the |
| 29 | \citetitle[http://python.sourceforge.net/devel-docs/ref/ref.html]{Python |
| 30 | Reference Manual}, or to the PEP for a particular new feature. |
| 31 | % These \citetitle marks should get the python.org URLs for the final |
| 32 | % release, just as soon as the docs are published there. |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 33 | |
| 34 | The final release of Python 2.2 is planned for October 2001. |
| 35 | |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 36 | |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 37 | %====================================================================== |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 38 | % It looks like this set of changes will likely get into 2.2, |
| 39 | % so I need to read and digest the relevant PEPs. |
Andrew M. Kuchling | 7bf8277 | 2001-07-11 18:54:26 +0000 | [diff] [blame] | 40 | %\section{PEP 252: Type and Class Changes} |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 41 | |
Andrew M. Kuchling | 7bf8277 | 2001-07-11 18:54:26 +0000 | [diff] [blame] | 42 | %XXX |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 43 | |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 44 | % GvR's description at http://www.python.org/2.2/descrintro.html |
| 45 | |
Andrew M. Kuchling | 7bf8277 | 2001-07-11 18:54:26 +0000 | [diff] [blame] | 46 | %\begin{seealso} |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 47 | |
Andrew M. Kuchling | 7bf8277 | 2001-07-11 18:54:26 +0000 | [diff] [blame] | 48 | %\seepep{252}{Making Types Look More Like Classes}{Written and implemented |
| 49 | %by GvR.} |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 50 | |
Andrew M. Kuchling | 7bf8277 | 2001-07-11 18:54:26 +0000 | [diff] [blame] | 51 | %\end{seealso} |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 52 | |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 53 | |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 54 | %====================================================================== |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 55 | \section{PEP 234: Iterators} |
| 56 | |
| 57 | A significant addition to 2.2 is an iteration interface at both the C |
| 58 | and Python levels. Objects can define how they can be looped over by |
| 59 | callers. |
| 60 | |
| 61 | In Python versions up to 2.1, the usual way to make \code{for item in |
| 62 | obj} work is to define a \method{__getitem__()} method that looks |
| 63 | something like this: |
| 64 | |
| 65 | \begin{verbatim} |
| 66 | def __getitem__(self, index): |
| 67 | return <next item> |
| 68 | \end{verbatim} |
| 69 | |
| 70 | \method{__getitem__()} is more properly used to define an indexing |
| 71 | operation on an object so that you can write \code{obj[5]} to retrieve |
Andrew M. Kuchling | 8c69c91 | 2001-08-07 14:28:58 +0000 | [diff] [blame^] | 72 | the sixth element. It's a bit misleading when you're using this only |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 73 | to support \keyword{for} loops. Consider some file-like object that |
| 74 | wants to be looped over; the \var{index} parameter is essentially |
| 75 | meaningless, as the class probably assumes that a series of |
| 76 | \method{__getitem__()} calls will be made, with \var{index} |
| 77 | incrementing by one each time. In other words, the presence of the |
| 78 | \method{__getitem__()} method doesn't mean that \code{file[5]} will |
| 79 | work, though it really should. |
| 80 | |
| 81 | In Python 2.2, iteration can be implemented separately, and |
| 82 | \method{__getitem__()} methods can be limited to classes that really |
| 83 | do support random access. The basic idea of iterators is quite |
| 84 | simple. A new built-in function, \function{iter(obj)}, returns an |
| 85 | iterator for the object \var{obj}. (It can also take two arguments: |
Fred Drake | 0d00254 | 2001-07-17 13:55:33 +0000 | [diff] [blame] | 86 | \code{iter(\var{C}, \var{sentinel})} will call the callable \var{C}, |
| 87 | until it returns \var{sentinel}, which will signal that the iterator |
| 88 | is done. This form probably won't be used very often.) |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 89 | |
| 90 | Python classes can define an \method{__iter__()} method, which should |
| 91 | create and return a new iterator for the object; if the object is its |
| 92 | own iterator, this method can just return \code{self}. In particular, |
| 93 | iterators will usually be their own iterators. Extension types |
| 94 | implemented in C can implement a \code{tp_iter} function in order to |
Andrew M. Kuchling | 4cf52a9 | 2001-07-17 12:48:48 +0000 | [diff] [blame] | 95 | return an iterator, and extension types that want to behave as |
| 96 | iterators can define a \code{tp_iternext} function. |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 97 | |
| 98 | So what do iterators do? They have one required method, |
| 99 | \method{next()}, which takes no arguments and returns the next value. |
| 100 | When there are no more values to be returned, calling \method{next()} |
| 101 | should raise the \exception{StopIteration} exception. |
| 102 | |
| 103 | \begin{verbatim} |
| 104 | >>> L = [1,2,3] |
| 105 | >>> i = iter(L) |
| 106 | >>> print i |
| 107 | <iterator object at 0x8116870> |
| 108 | >>> i.next() |
| 109 | 1 |
| 110 | >>> i.next() |
| 111 | 2 |
| 112 | >>> i.next() |
| 113 | 3 |
| 114 | >>> i.next() |
| 115 | Traceback (most recent call last): |
| 116 | File "<stdin>", line 1, in ? |
| 117 | StopIteration |
| 118 | >>> |
| 119 | \end{verbatim} |
| 120 | |
| 121 | In 2.2, Python's \keyword{for} statement no longer expects a sequence; |
| 122 | it expects something for which \function{iter()} will return something. |
| 123 | For backward compatibility, and convenience, an iterator is |
| 124 | automatically constructed for sequences that don't implement |
| 125 | \method{__iter__()} or a \code{tp_iter} slot, so \code{for i in |
| 126 | [1,2,3]} will still work. Wherever the Python interpreter loops over |
| 127 | a sequence, it's been changed to use the iterator protocol. This |
| 128 | means you can do things like this: |
| 129 | |
| 130 | \begin{verbatim} |
| 131 | >>> i = iter(L) |
| 132 | >>> a,b,c = i |
| 133 | >>> a,b,c |
| 134 | (1, 2, 3) |
| 135 | >>> |
| 136 | \end{verbatim} |
| 137 | |
| 138 | Iterator support has been added to some of Python's basic types. The |
| 139 | \keyword{in} operator now works on dictionaries, so \code{\var{key} in |
| 140 | dict} is now equivalent to \code{dict.has_key(\var{key})}. |
Fred Drake | 0d00254 | 2001-07-17 13:55:33 +0000 | [diff] [blame] | 141 | Calling \function{iter()} on a dictionary will return an iterator |
Andrew M. Kuchling | 6ea9f0b | 2001-07-17 14:50:31 +0000 | [diff] [blame] | 142 | which loops over its keys: |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 143 | |
| 144 | \begin{verbatim} |
| 145 | >>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, |
| 146 | ... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12} |
| 147 | >>> for key in m: print key, m[key] |
| 148 | ... |
| 149 | Mar 3 |
| 150 | Feb 2 |
| 151 | Aug 8 |
| 152 | Sep 9 |
| 153 | May 5 |
| 154 | Jun 6 |
| 155 | Jul 7 |
| 156 | Jan 1 |
| 157 | Apr 4 |
| 158 | Nov 11 |
| 159 | Dec 12 |
| 160 | Oct 10 |
| 161 | >>> |
| 162 | \end{verbatim} |
| 163 | |
| 164 | That's just the default behaviour. If you want to iterate over keys, |
| 165 | values, or key/value pairs, you can explicitly call the |
| 166 | \method{iterkeys()}, \method{itervalues()}, or \method{iteritems()} |
| 167 | methods to get an appropriate iterator. |
| 168 | |
| 169 | Files also provide an iterator, which calls its \method{readline()} |
| 170 | method until there are no more lines in the file. This means you can |
| 171 | now read each line of a file using code like this: |
| 172 | |
| 173 | \begin{verbatim} |
| 174 | for line in file: |
| 175 | # do something for each line |
| 176 | \end{verbatim} |
| 177 | |
| 178 | Note that you can only go forward in an iterator; there's no way to |
| 179 | get the previous element, reset the iterator, or make a copy of it. |
Fred Drake | 0d00254 | 2001-07-17 13:55:33 +0000 | [diff] [blame] | 180 | An iterator object could provide such additional capabilities, but the |
| 181 | iterator protocol only requires a \method{next()} method. |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 182 | |
| 183 | \begin{seealso} |
| 184 | |
| 185 | \seepep{234}{Iterators}{Written by Ka-Ping Yee and GvR; implemented |
| 186 | by the Python Labs crew, mostly by GvR and Tim Peters.} |
| 187 | |
| 188 | \end{seealso} |
| 189 | |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 190 | |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 191 | %====================================================================== |
| 192 | \section{PEP 255: Simple Generators} |
| 193 | |
| 194 | Generators are another new feature, one that interacts with the |
| 195 | introduction of iterators. |
| 196 | |
| 197 | You're doubtless familiar with how function calls work in Python or |
| 198 | C. When you call a function, it gets a private area where its local |
| 199 | variables are created. When the function reaches a \keyword{return} |
| 200 | statement, the local variables are destroyed and the resulting value |
| 201 | is returned to the caller. A later call to the same function will get |
| 202 | a fresh new set of local variables. But, what if the local variables |
| 203 | weren't destroyed on exiting a function? What if you could later |
| 204 | resume the function where it left off? This is what generators |
| 205 | provide; they can be thought of as resumable functions. |
| 206 | |
| 207 | Here's the simplest example of a generator function: |
| 208 | |
| 209 | \begin{verbatim} |
| 210 | def generate_ints(N): |
| 211 | for i in range(N): |
| 212 | yield i |
| 213 | \end{verbatim} |
| 214 | |
| 215 | A new keyword, \keyword{yield}, was introduced for generators. Any |
| 216 | function containing a \keyword{yield} statement is a generator |
| 217 | function; this is detected by Python's bytecode compiler which |
Andrew M. Kuchling | 4cf52a9 | 2001-07-17 12:48:48 +0000 | [diff] [blame] | 218 | compiles the function specially. Because a new keyword was |
| 219 | introduced, generators must be explicitly enabled in a module by |
| 220 | including a \code{from __future__ import generators} statement near |
| 221 | the top of the module's source code. In Python 2.3 this statement |
| 222 | will become unnecessary. |
| 223 | |
| 224 | When you call a generator function, it doesn't return a single value; |
| 225 | instead it returns a generator object that supports the iterator |
| 226 | interface. On executing the \keyword{yield} statement, the generator |
| 227 | outputs the value of \code{i}, similar to a \keyword{return} |
| 228 | statement. The big difference between \keyword{yield} and a |
| 229 | \keyword{return} statement is that, on reaching a \keyword{yield} the |
| 230 | generator's state of execution is suspended and local variables are |
| 231 | preserved. On the next call to the generator's \code{.next()} method, |
| 232 | the function will resume executing immediately after the |
| 233 | \keyword{yield} statement. (For complicated reasons, the |
| 234 | \keyword{yield} statement isn't allowed inside the \keyword{try} block |
| 235 | of a \code{try...finally} statement; read PEP 255 for a full |
| 236 | explanation of the interaction between \keyword{yield} and |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 237 | exceptions.) |
| 238 | |
| 239 | Here's a sample usage of the \function{generate_ints} generator: |
| 240 | |
| 241 | \begin{verbatim} |
| 242 | >>> gen = generate_ints(3) |
| 243 | >>> gen |
| 244 | <generator object at 0x8117f90> |
| 245 | >>> gen.next() |
| 246 | 0 |
| 247 | >>> gen.next() |
| 248 | 1 |
| 249 | >>> gen.next() |
| 250 | 2 |
| 251 | >>> gen.next() |
| 252 | Traceback (most recent call last): |
| 253 | File "<stdin>", line 1, in ? |
| 254 | File "<stdin>", line 2, in generate_ints |
| 255 | StopIteration |
| 256 | >>> |
| 257 | \end{verbatim} |
| 258 | |
| 259 | You could equally write \code{for i in generate_ints(5)}, or |
| 260 | \code{a,b,c = generate_ints(3)}. |
| 261 | |
| 262 | Inside a generator function, the \keyword{return} statement can only |
Andrew M. Kuchling | 4cf52a9 | 2001-07-17 12:48:48 +0000 | [diff] [blame] | 263 | be used without a value, and signals the end of the procession of |
| 264 | values; afterwards the generator cannot return any further values. |
| 265 | \keyword{return} with a value, such as \code{return 5}, is a syntax |
| 266 | error inside a generator function. The end of the generator's results |
| 267 | can also be indicated by raising \exception{StopIteration} manually, |
| 268 | or by just letting the flow of execution fall off the bottom of the |
| 269 | function. |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 270 | |
| 271 | You could achieve the effect of generators manually by writing your |
Andrew M. Kuchling | 4cf52a9 | 2001-07-17 12:48:48 +0000 | [diff] [blame] | 272 | own class and storing all the local variables of the generator as |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 273 | instance variables. For example, returning a list of integers could |
| 274 | be done by setting \code{self.count} to 0, and having the |
| 275 | \method{next()} method increment \code{self.count} and return it. |
Andrew M. Kuchling | c32cc7c | 2001-07-17 18:25:01 +0000 | [diff] [blame] | 276 | However, for a moderately complicated generator, writing a |
| 277 | corresponding class would be much messier. |
| 278 | \file{Lib/test/test_generators.py} contains a number of more |
| 279 | interesting examples. The simplest one implements an in-order |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 280 | traversal of a tree using generators recursively. |
| 281 | |
| 282 | \begin{verbatim} |
| 283 | # A recursive generator that generates Tree leaves in in-order. |
| 284 | def inorder(t): |
| 285 | if t: |
| 286 | for x in inorder(t.left): |
| 287 | yield x |
| 288 | yield t.label |
| 289 | for x in inorder(t.right): |
| 290 | yield x |
| 291 | \end{verbatim} |
| 292 | |
| 293 | Two other examples in \file{Lib/test/test_generators.py} produce |
| 294 | solutions for the N-Queens problem (placing $N$ queens on an $NxN$ |
| 295 | chess board so that no queen threatens another) and the Knight's Tour |
| 296 | (a route that takes a knight to every square of an $NxN$ chessboard |
| 297 | without visiting any square twice). |
| 298 | |
| 299 | The idea of generators comes from other programming languages, |
| 300 | especially Icon (\url{http://www.cs.arizona.edu/icon/}), where the |
| 301 | idea of generators is central to the language. In Icon, every |
| 302 | expression and function call behaves like a generator. One example |
| 303 | from ``An Overview of the Icon Programming Language'' at |
| 304 | \url{http://www.cs.arizona.edu/icon/docs/ipd266.htm} gives an idea of |
| 305 | what this looks like: |
| 306 | |
| 307 | \begin{verbatim} |
| 308 | sentence := "Store it in the neighboring harbor" |
| 309 | if (i := find("or", sentence)) > 5 then write(i) |
| 310 | \end{verbatim} |
| 311 | |
| 312 | The \function{find()} function returns the indexes at which the |
| 313 | substring ``or'' is found: 3, 23, 33. In the \keyword{if} statement, |
| 314 | \code{i} is first assigned a value of 3, but 3 is less than 5, so the |
| 315 | comparison fails, and Icon retries it with the second value of 23. 23 |
| 316 | is greater than 5, so the comparison now succeeds, and the code prints |
| 317 | the value 23 to the screen. |
| 318 | |
| 319 | Python doesn't go nearly as far as Icon in adopting generators as a |
| 320 | central concept. Generators are considered a new part of the core |
| 321 | Python language, but learning or using them isn't compulsory; if they |
| 322 | don't solve any problems that you have, feel free to ignore them. |
| 323 | This is different from Icon where the idea of generators is a basic |
| 324 | concept. One novel feature of Python's interface as compared to |
| 325 | Icon's is that a generator's state is represented as a concrete object |
| 326 | that can be passed around to other functions or stored in a data |
| 327 | structure. |
| 328 | |
| 329 | \begin{seealso} |
| 330 | |
Andrew M. Kuchling | 4cf52a9 | 2001-07-17 12:48:48 +0000 | [diff] [blame] | 331 | \seepep{255}{Simple Generators}{Written by Neil Schemenauer, Tim |
| 332 | Peters, Magnus Lie Hetland. Implemented mostly by Neil Schemenauer |
| 333 | and Tim Peters, with other fixes from the Python Labs crew.} |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 334 | |
| 335 | \end{seealso} |
| 336 | |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 337 | |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 338 | %====================================================================== |
Andrew M. Kuchling | a43e703 | 2001-06-27 20:32:12 +0000 | [diff] [blame] | 339 | \section{Unicode Changes} |
| 340 | |
Andrew M. Kuchling | 2cd712b | 2001-07-16 13:39:08 +0000 | [diff] [blame] | 341 | Python's Unicode support has been enhanced a bit in 2.2. Unicode |
Andrew M. Kuchling | a6d2a04 | 2001-07-20 18:34:34 +0000 | [diff] [blame] | 342 | strings are usually stored as UCS-2, as 16-bit unsigned integers. |
Andrew M. Kuchling | f5fec3c | 2001-07-19 01:48:08 +0000 | [diff] [blame] | 343 | Python 2.2 can also be compiled to use UCS-4, 32-bit unsigned |
| 344 | integers, as its internal encoding by supplying |
| 345 | \longprogramopt{enable-unicode=ucs4} to the configure script. When |
Andrew M. Kuchling | ab01087 | 2001-07-19 14:59:53 +0000 | [diff] [blame] | 346 | built to use UCS-4 (a ``wide Python''), the interpreter can natively |
Andrew M. Kuchling | a6d2a04 | 2001-07-20 18:34:34 +0000 | [diff] [blame] | 347 | handle Unicode characters from U+000000 to U+110000, so the range of |
| 348 | legal values for the \function{unichr()} function is expanded |
| 349 | accordingly. Using an interpreter compiled to use UCS-2 (a ``narrow |
| 350 | Python''), values greater than 65535 will still cause |
| 351 | \function{unichr()} to raise a \exception{ValueError} exception. |
Andrew M. Kuchling | ab01087 | 2001-07-19 14:59:53 +0000 | [diff] [blame] | 352 | |
| 353 | All this is the province of the still-unimplemented PEP 261, ``Support |
| 354 | for `wide' Unicode characters''; consult it for further details, and |
Andrew M. Kuchling | a6d2a04 | 2001-07-20 18:34:34 +0000 | [diff] [blame] | 355 | please offer comments on the PEP and on your experiences with the |
| 356 | 2.2 alpha releases. |
| 357 | % XXX update previous line once 2.2 reaches beta. |
Andrew M. Kuchling | ab01087 | 2001-07-19 14:59:53 +0000 | [diff] [blame] | 358 | |
| 359 | Another change is much simpler to explain. Since their introduction, |
| 360 | Unicode strings have supported an \method{encode()} method to convert |
| 361 | the string to a selected encoding such as UTF-8 or Latin-1. A |
| 362 | symmetric \method{decode(\optional{\var{encoding}})} method has been |
| 363 | added to 8-bit strings (though not to Unicode strings) in 2.2. |
| 364 | \method{decode()} assumes that the string is in the specified encoding |
| 365 | and decodes it, returning whatever is returned by the codec. |
| 366 | |
| 367 | Using this new feature, codecs have been added for tasks not directly |
| 368 | related to Unicode. For example, codecs have been added for |
| 369 | uu-encoding, MIME's base64 encoding, and compression with the |
| 370 | \module{zlib} module: |
Andrew M. Kuchling | 2cd712b | 2001-07-16 13:39:08 +0000 | [diff] [blame] | 371 | |
| 372 | \begin{verbatim} |
| 373 | >>> s = """Here is a lengthy piece of redundant, overly verbose, |
| 374 | ... and repetitive text. |
| 375 | ... """ |
| 376 | >>> data = s.encode('zlib') |
| 377 | >>> data |
| 378 | 'x\x9c\r\xc9\xc1\r\x80 \x10\x04\xc0?Ul...' |
| 379 | >>> data.decode('zlib') |
| 380 | 'Here is a lengthy piece of redundant, overly verbose,\nand repetitive text.\n' |
| 381 | >>> print s.encode('uu') |
| 382 | begin 666 <data> |
| 383 | M2&5R92!I<R!A(&QE;F=T:'D@<&EE8V4@;V8@<F5D=6YD86YT+"!O=F5R;'D@ |
| 384 | >=F5R8F]S92P*86YD(')E<&5T:71I=F4@=&5X="X* |
| 385 | |
| 386 | end |
| 387 | >>> "sheesh".encode('rot-13') |
| 388 | 'furrfu' |
| 389 | \end{verbatim} |
Andrew M. Kuchling | a43e703 | 2001-06-27 20:32:12 +0000 | [diff] [blame] | 390 | |
Andrew M. Kuchling | f5fec3c | 2001-07-19 01:48:08 +0000 | [diff] [blame] | 391 | \method{encode()} and \method{decode()} were implemented by |
| 392 | Marc-Andr\'e Lemburg. The changes to support using UCS-4 internally |
| 393 | were implemented by Fredrik Lundh and Martin von L\"owis. |
Andrew M. Kuchling | a43e703 | 2001-06-27 20:32:12 +0000 | [diff] [blame] | 394 | |
Andrew M. Kuchling | f5fec3c | 2001-07-19 01:48:08 +0000 | [diff] [blame] | 395 | \begin{seealso} |
| 396 | |
| 397 | \seepep{261}{Support for `wide' Unicode characters}{PEP written by |
| 398 | Paul Prescod. Not yet accepted or fully implemented.} |
| 399 | |
| 400 | \end{seealso} |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 401 | |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 402 | %====================================================================== |
| 403 | \section{PEP 227: Nested Scopes} |
| 404 | |
| 405 | In Python 2.1, statically nested scopes were added as an optional |
| 406 | feature, to be enabled by a \code{from __future__ import |
| 407 | nested_scopes} directive. In 2.2 nested scopes no longer need to be |
| 408 | specially enabled, but are always enabled. The rest of this section |
| 409 | is a copy of the description of nested scopes from my ``What's New in |
| 410 | Python 2.1'' document; if you read it when 2.1 came out, you can skip |
| 411 | the rest of this section. |
| 412 | |
| 413 | The largest change introduced in Python 2.1, and made complete in 2.2, |
| 414 | is to Python's scoping rules. In Python 2.0, at any given time there |
| 415 | are at most three namespaces used to look up variable names: local, |
| 416 | module-level, and the built-in namespace. This often surprised people |
| 417 | because it didn't match their intuitive expectations. For example, a |
| 418 | nested recursive function definition doesn't work: |
| 419 | |
| 420 | \begin{verbatim} |
| 421 | def f(): |
| 422 | ... |
| 423 | def g(value): |
| 424 | ... |
| 425 | return g(value-1) + 1 |
| 426 | ... |
| 427 | \end{verbatim} |
| 428 | |
| 429 | The function \function{g()} will always raise a \exception{NameError} |
| 430 | exception, because the binding of the name \samp{g} isn't in either |
| 431 | its local namespace or in the module-level namespace. This isn't much |
| 432 | of a problem in practice (how often do you recursively define interior |
| 433 | functions like this?), but this also made using the \keyword{lambda} |
| 434 | statement clumsier, and this was a problem in practice. In code which |
| 435 | uses \keyword{lambda} you can often find local variables being copied |
| 436 | by passing them as the default values of arguments. |
| 437 | |
| 438 | \begin{verbatim} |
| 439 | def find(self, name): |
| 440 | "Return list of any entries equal to 'name'" |
| 441 | L = filter(lambda x, name=name: x == name, |
| 442 | self.list_attribute) |
| 443 | return L |
| 444 | \end{verbatim} |
| 445 | |
| 446 | The readability of Python code written in a strongly functional style |
| 447 | suffers greatly as a result. |
| 448 | |
| 449 | The most significant change to Python 2.2 is that static scoping has |
| 450 | been added to the language to fix this problem. As a first effect, |
| 451 | the \code{name=name} default argument is now unnecessary in the above |
| 452 | example. Put simply, when a given variable name is not assigned a |
| 453 | value within a function (by an assignment, or the \keyword{def}, |
| 454 | \keyword{class}, or \keyword{import} statements), references to the |
| 455 | variable will be looked up in the local namespace of the enclosing |
| 456 | scope. A more detailed explanation of the rules, and a dissection of |
| 457 | the implementation, can be found in the PEP. |
| 458 | |
| 459 | This change may cause some compatibility problems for code where the |
| 460 | same variable name is used both at the module level and as a local |
| 461 | variable within a function that contains further function definitions. |
| 462 | This seems rather unlikely though, since such code would have been |
| 463 | pretty confusing to read in the first place. |
| 464 | |
| 465 | One side effect of the change is that the \code{from \var{module} |
| 466 | import *} and \keyword{exec} statements have been made illegal inside |
| 467 | a function scope under certain conditions. The Python reference |
| 468 | manual has said all along that \code{from \var{module} import *} is |
| 469 | only legal at the top level of a module, but the CPython interpreter |
| 470 | has never enforced this before. As part of the implementation of |
| 471 | nested scopes, the compiler which turns Python source into bytecodes |
| 472 | has to generate different code to access variables in a containing |
| 473 | scope. \code{from \var{module} import *} and \keyword{exec} make it |
| 474 | impossible for the compiler to figure this out, because they add names |
| 475 | to the local namespace that are unknowable at compile time. |
| 476 | Therefore, if a function contains function definitions or |
| 477 | \keyword{lambda} expressions with free variables, the compiler will |
| 478 | flag this by raising a \exception{SyntaxError} exception. |
| 479 | |
| 480 | To make the preceding explanation a bit clearer, here's an example: |
| 481 | |
| 482 | \begin{verbatim} |
| 483 | x = 1 |
| 484 | def f(): |
| 485 | # The next line is a syntax error |
| 486 | exec 'x=2' |
| 487 | def g(): |
| 488 | return x |
| 489 | \end{verbatim} |
| 490 | |
| 491 | Line 4 containing the \keyword{exec} statement is a syntax error, |
| 492 | since \keyword{exec} would define a new local variable named \samp{x} |
| 493 | whose value should be accessed by \function{g()}. |
| 494 | |
| 495 | This shouldn't be much of a limitation, since \keyword{exec} is rarely |
| 496 | used in most Python code (and when it is used, it's often a sign of a |
| 497 | poor design anyway). |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 498 | |
| 499 | \begin{seealso} |
| 500 | |
| 501 | \seepep{227}{Statically Nested Scopes}{Written and implemented by |
| 502 | Jeremy Hylton.} |
| 503 | |
| 504 | \end{seealso} |
| 505 | |
Andrew M. Kuchling | a43e703 | 2001-06-27 20:32:12 +0000 | [diff] [blame] | 506 | |
| 507 | %====================================================================== |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 508 | \section{New and Improved Modules} |
| 509 | |
| 510 | \begin{itemize} |
| 511 | |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 512 | \item The \module{xmlrpclib} module was contributed to the standard |
Andrew M. Kuchling | 8c69c91 | 2001-08-07 14:28:58 +0000 | [diff] [blame^] | 513 | library by Fredrik Lundh. It provides support for writing XML-RPC |
| 514 | clients; XML-RPC is a simple remote procedure call protocol built on |
| 515 | top of HTTP and XML. For example, the following snippet retrieves a |
| 516 | list of RSS channels from the O'Reilly Network, and then retrieves a |
| 517 | list of the recent headlines for one channel: |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 518 | |
| 519 | \begin{verbatim} |
| 520 | import xmlrpclib |
| 521 | s = xmlrpclib.Server( |
| 522 | 'http://www.oreillynet.com/meerkat/xml-rpc/server.php') |
| 523 | channels = s.meerkat.getChannels() |
| 524 | # channels is a list of dictionaries, like this: |
| 525 | # [{'id': 4, 'title': 'Freshmeat Daily News'} |
| 526 | # {'id': 190, 'title': '32Bits Online'}, |
| 527 | # {'id': 4549, 'title': '3DGamers'}, ... ] |
| 528 | |
| 529 | # Get the items for one channel |
| 530 | items = s.meerkat.getItems( {'channel': 4} ) |
| 531 | |
| 532 | # 'items' is another list of dictionaries, like this: |
| 533 | # [{'link': 'http://freshmeat.net/releases/52719/', |
| 534 | # 'description': 'A utility which converts HTML to XSL FO.', |
| 535 | # 'title': 'html2fo 0.3 (Default)'}, ... ] |
| 536 | \end{verbatim} |
| 537 | |
Fred Drake | 0d00254 | 2001-07-17 13:55:33 +0000 | [diff] [blame] | 538 | See \url{http://www.xmlrpc.com/} for more information about XML-RPC. |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 539 | |
| 540 | \item The \module{socket} module can be compiled to support IPv6; |
Andrew M. Kuchling | ddeb135 | 2001-07-16 14:35:52 +0000 | [diff] [blame] | 541 | specify the \longprogramopt{enable-ipv6} option to Python's configure |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 542 | script. (Contributed by Jun-ichiro ``itojun'' Hagino.) |
| 543 | |
| 544 | \item Two new format characters were added to the \module{struct} |
| 545 | module for 64-bit integers on platforms that support the C |
| 546 | \ctype{long long} type. \samp{q} is for a signed 64-bit integer, |
| 547 | and \samp{Q} is for an unsigned one. The value is returned in |
| 548 | Python's long integer type. (Contributed by Tim Peters.) |
| 549 | |
| 550 | \item In the interpreter's interactive mode, there's a new built-in |
| 551 | function \function{help()}, that uses the \module{pydoc} module |
| 552 | introduced in Python 2.1 to provide interactive. |
| 553 | \code{help(\var{object})} displays any available help text about |
| 554 | \var{object}. \code{help()} with no argument puts you in an online |
| 555 | help utility, where you can enter the names of functions, classes, |
| 556 | or modules to read their help text. |
| 557 | (Contributed by Guido van Rossum, using Ka-Ping Yee's \module{pydoc} module.) |
| 558 | |
| 559 | \item Various bugfixes and performance improvements have been made |
Andrew M. Kuchling | 4cf52a9 | 2001-07-17 12:48:48 +0000 | [diff] [blame] | 560 | to the SRE engine underlying the \module{re} module. For example, |
| 561 | \function{re.sub()} will now use \function{string.replace()} |
| 562 | automatically when the pattern and its replacement are both just |
| 563 | literal strings without regex metacharacters. Another contributed |
| 564 | patch speeds up certain Unicode character ranges by a factor of |
| 565 | two. (SRE is maintained by Fredrik Lundh. The BIGCHARSET patch was |
| 566 | contributed by Martin von L\"owis.) |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 567 | |
Andrew M. Kuchling | a6d2a04 | 2001-07-20 18:34:34 +0000 | [diff] [blame] | 568 | \item The \module{imaplib} module, maintained by Piers Lauder, has |
| 569 | support for several new extensions: the NAMESPACE extension defined |
| 570 | in \rfc{2342}, SORT, GETACL and SETACL. (Contributed by Anthony |
| 571 | Baxter and Michel Pelletier.) |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 572 | |
Fred Drake | 0d00254 | 2001-07-17 13:55:33 +0000 | [diff] [blame] | 573 | \item The \module{rfc822} module's parsing of email addresses is |
Andrew M. Kuchling | 4cf52a9 | 2001-07-17 12:48:48 +0000 | [diff] [blame] | 574 | now compliant with \rfc{2822}, an update to \rfc{822}. The module's |
| 575 | name is \emph{not} going to be changed to \samp{rfc2822}. |
| 576 | (Contributed by Barry Warsaw.) |
Andrew M. Kuchling | 7770767 | 2001-07-31 15:51:16 +0000 | [diff] [blame] | 577 | |
| 578 | \item New constants \constant{ascii_letters}, |
| 579 | \constant{ascii_lowercase}, and \constant{ascii_uppercase} were |
| 580 | added to the \module{string} module. There were several modules in |
| 581 | the standard library that used \constant{string.letters} to mean the |
| 582 | ranges A-Za-z, but that assumption is incorrect when locales are in |
| 583 | use, because \constant{string.letters} varies depending on the set |
| 584 | of legal characters defined by the current locale. The buggy |
| 585 | modules have all been fixed to use \constant{ascii_letters} instead. |
| 586 | (Reported by an unknown person; fixed by Fred L. Drake, Jr.) |
| 587 | |
Andrew M. Kuchling | 8c69c91 | 2001-08-07 14:28:58 +0000 | [diff] [blame^] | 588 | \item The \module{mimetypes} module now makes it easier to use |
| 589 | alternative MIME-type databases by the addition of a |
| 590 | \class{MimeTypes} class, which takes a list of filenames to be |
| 591 | parsed. (Contributed by Fred L. Drake, Jr.) |
| 592 | |
Andrew M. Kuchling | 7770767 | 2001-07-31 15:51:16 +0000 | [diff] [blame] | 593 | \end{itemize} |
| 594 | |
| 595 | |
| 596 | %====================================================================== |
| 597 | \section{Interpreter Changes and Fixes} |
| 598 | |
| 599 | Some of the changes only affect people who deal with the Python |
| 600 | interpreter at the C level, writing Python extension modules, |
| 601 | embedding the interpreter, or just hacking on the interpreter itself. |
| 602 | If you only write Python code, none of the changes described here will |
| 603 | affect you very much. |
| 604 | |
| 605 | \begin{itemize} |
| 606 | |
| 607 | \item Profiling and tracing functions can now be implemented in C, |
| 608 | which can operate at much higher speeds than Python-based functions |
| 609 | and should reduce the overhead of enabling profiling and tracing, so |
| 610 | it will be of interest to authors of development environments for |
| 611 | Python. Two new C functions were added to Python's API, |
| 612 | \cfunction{PyEval_SetProfile()} and \cfunction{PyEval_SetTrace()}. |
| 613 | The existing \function{sys.setprofile()} and |
| 614 | \function{sys.settrace()} functions still exist, and have simply |
| 615 | been changed to use the new C-level interface. (Contributed by Fred |
| 616 | L. Drake, Jr.) |
| 617 | |
| 618 | \item Another low-level API, primarily of interest to implementors |
| 619 | of Python debuggers and development tools, was added. |
| 620 | \cfunction{PyInterpreterState_Head()} and |
| 621 | \cfunction{PyInterpreterState_Next()} let a caller walk through all |
| 622 | the existing interpreter objects; |
| 623 | \cfunction{PyInterpreterState_ThreadHead()} and |
| 624 | \cfunction{PyThreadState_Next()} allow looping over all the thread |
| 625 | states for a given interpreter. (Contributed by David Beazley.) |
| 626 | |
| 627 | \item A new \samp{et} format sequence was added to |
| 628 | \cfunction{PyArg_ParseTuple}; \samp{et} takes both a parameter and |
| 629 | an encoding name, and converts the parameter to the given encoding |
| 630 | if the parameter turns out to be a Unicode string, or leaves it |
| 631 | alone if it's an 8-bit string, assuming it to already be in the |
| 632 | desired encoding. This differs from the \samp{es} format character, |
| 633 | which assumes that 8-bit strings are in Python's default ASCII |
| 634 | encoding and converts them to the specified new encoding. |
| 635 | (Contributed by M.-A. Lemburg, and used for the MBCS support on |
| 636 | Windows described in the previous section.) |
| 637 | |
| 638 | \item Two new wrapper functions, \cfunction{PyOS_snprintf()} and |
| 639 | \cfunction{PyOS_vsnprintf()} were added. which provide a cross-platform |
| 640 | implementations for the relatively new snprintf()/vsnprintf() C lib |
| 641 | APIs. In contrast to the standard sprintf() and vsprintf() C lib |
| 642 | APIs, these versions apply bounds checking on the used buffer which |
| 643 | enhances protection against buffer overruns. |
| 644 | (Contributed by M.-A. Lemburg.) |
| 645 | |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 646 | \end{itemize} |
| 647 | |
| 648 | |
| 649 | %====================================================================== |
| 650 | \section{Other Changes and Fixes} |
| 651 | |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 652 | % XXX update the patch and bug figures as we go |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 653 | As usual there were a bunch of other improvements and bugfixes |
| 654 | scattered throughout the source tree. A search through the CVS change |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 655 | logs finds there were 43 patches applied, and 77 bugs fixed; both |
Andrew M. Kuchling | 4dbf871 | 2001-07-16 02:17:14 +0000 | [diff] [blame] | 656 | figures are likely to be underestimates. Some of the more notable |
| 657 | changes are: |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 658 | |
| 659 | \begin{itemize} |
| 660 | |
Andrew M. Kuchling | 2cd712b | 2001-07-16 13:39:08 +0000 | [diff] [blame] | 661 | \item Keyword arguments passed to builtin functions that don't take them |
| 662 | now cause a \exception{TypeError} exception to be raised, with the |
| 663 | message "\var{function} takes no keyword arguments". |
| 664 | |
Fred Drake | 0d00254 | 2001-07-17 13:55:33 +0000 | [diff] [blame] | 665 | \item The code for the Mac OS port for Python, maintained by Jack |
Andrew M. Kuchling | 2cd712b | 2001-07-16 13:39:08 +0000 | [diff] [blame] | 666 | Jansen, is now kept in the main Python CVS tree. |
| 667 | |
| 668 | \item The new license introduced with Python 1.6 wasn't |
| 669 | GPL-compatible. This is fixed by some minor textual changes to the |
| 670 | 2.2 license, so Python can now be embedded inside a GPLed program |
| 671 | again. The license changes were also applied to the Python 2.0.1 |
| 672 | and 2.1.1 releases. |
| 673 | |
Andrew M. Kuchling | f4ccf58 | 2001-07-31 01:11:36 +0000 | [diff] [blame] | 674 | \item When presented with a Unicode filename on Windows, Python will |
| 675 | now convert it to an MBCS encoded string, as used by the Microsoft |
| 676 | file APIs. As MBCS is explicitly used by the file APIs, Python's |
| 677 | choice of ASCII as the default encoding turns out to be an |
| 678 | annoyance. |
| 679 | |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 680 | (Contributed by Mark Hammond with assistance from Marc-Andr\'e |
| 681 | Lemburg.) |
| 682 | |
Andrew M. Kuchling | 2cd712b | 2001-07-16 13:39:08 +0000 | [diff] [blame] | 683 | \item The \file{Tools/scripts/ftpmirror.py} script |
| 684 | now parses a \file{.netrc} file, if you have one. |
Andrew M. Kuchling | 4cf52a9 | 2001-07-17 12:48:48 +0000 | [diff] [blame] | 685 | (Contributed by Mike Romberg.) |
Andrew M. Kuchling | 2cd712b | 2001-07-16 13:39:08 +0000 | [diff] [blame] | 686 | |
Andrew M. Kuchling | 4cf52a9 | 2001-07-17 12:48:48 +0000 | [diff] [blame] | 687 | \item Some features of the object returned by the |
| 688 | \function{xrange()} function are now deprecated, and trigger |
| 689 | warnings when they're accessed; they'll disappear in Python 2.3. |
| 690 | \class{xrange} objects tried to pretend they were full sequence |
| 691 | types by supporting slicing, sequence multiplication, and the |
| 692 | \keyword{in} operator, but these features were rarely used and |
| 693 | therefore buggy. The \method{tolist()} method and the |
| 694 | \member{start}, \member{stop}, and \member{step} attributes are also |
| 695 | being deprecated. At the C level, the fourth argument to the |
| 696 | \cfunction{PyRange_New()} function, \samp{repeat}, has also been |
| 697 | deprecated. |
| 698 | |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 699 | \item There were a bunch of patches to the dictionary |
| 700 | implementation, mostly to fix potential core dumps if a dictionary |
| 701 | contains objects that sneakily changed their hash value, or mutated |
| 702 | the dictionary they were contained in. For a while python-dev fell |
| 703 | into a gentle rhythm of Michael Hudson finding a case that dump |
| 704 | core, Tim Peters fixing it, Michael finding another case, and round |
| 705 | and round it went. |
| 706 | |
Andrew M. Kuchling | 4cf52a9 | 2001-07-17 12:48:48 +0000 | [diff] [blame] | 707 | \item On Windows, Python can now be compiled with Borland C thanks |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 708 | to a number of patches contributed by Stephen Hansen. |
Andrew M. Kuchling | 8c69c91 | 2001-08-07 14:28:58 +0000 | [diff] [blame^] | 709 | |
Andrew M. Kuchling | f4ccf58 | 2001-07-31 01:11:36 +0000 | [diff] [blame] | 710 | \item Another Windows enhancement: Wise Solutions generously offered |
| 711 | PythonLabs use of their InstallerMaster 8.1 system. Earlier |
| 712 | PythonLabs Windows installers used Wise 5.0a, which was beginning to |
| 713 | show its age. (Packaged up by Tim Peters.) |
| 714 | |
Andrew M. Kuchling | 8c69c91 | 2001-08-07 14:28:58 +0000 | [diff] [blame^] | 715 | \item Files ending in \samp{.pyw} can now be imported on Windows. |
| 716 | \samp{.pyw} is a Windows-only thing, used to indicate that a script |
| 717 | needs to be run using PYTHONW.EXE instead of PYTHON.EXE in order to |
| 718 | prevent a DOS console from popping up to display the output. This |
| 719 | patch makes it possible to import such scripts, in case they're also |
| 720 | usable as modules. (Implemented by David Bolen.) |
| 721 | |
Andrew M. Kuchling | 8cfa905 | 2001-07-19 01:19:59 +0000 | [diff] [blame] | 722 | \item On platforms where Python uses the C \cfunction{dlopen()} function |
| 723 | to load extension modules, it's now possible to set the flags used |
| 724 | by \cfunction{dlopen()} using the \function{sys.getdlopenflags()} and |
| 725 | \function{sys.setdlopenflags()} functions. (Contributed by Bram Stolk.) |
Andrew M. Kuchling | 7770767 | 2001-07-31 15:51:16 +0000 | [diff] [blame] | 726 | |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 727 | \end{itemize} |
| 728 | |
| 729 | |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 730 | %====================================================================== |
| 731 | \section{Acknowledgements} |
| 732 | |
| 733 | The author would like to thank the following people for offering |
Andrew M. Kuchling | 6ea9f0b | 2001-07-17 14:50:31 +0000 | [diff] [blame] | 734 | suggestions and corrections to various drafts of this article: Fred |
Andrew M. Kuchling | 8c69c91 | 2001-08-07 14:28:58 +0000 | [diff] [blame^] | 735 | Bremmer, Keith Briggs, Fred L. Drake, Jr., Mark Hammond, Marc-Andr\'e |
| 736 | Lemburg, Tim Peters, Neil Schemenauer, Guido van Rossum. |
Andrew M. Kuchling | a8defaa | 2001-05-05 16:37:29 +0000 | [diff] [blame] | 737 | |
| 738 | \end{document} |