|
1 | 1 | \documentclass{howto} |
2 | 2 |
|
3 | 3 | \title{What's New in Python 1.6} |
4 | | -\release{0.02} |
| 4 | +\release{0.03} |
5 | 5 | \author{A.M. Kuchling and Moshe Zadka} |
6 | 6 | \authoraddress{ \email{ [email protected]}, \email{ [email protected]} } |
7 | 7 | \begin{document} |
@@ -55,14 +55,15 @@ \section{Unicode} |
55 | 55 | by \code{\e 777}. |
56 | 56 |
|
57 | 57 | Unicode strings, just like regular strings, are an immutable sequence |
58 | | -type, so they can be indexed and sliced. They also have an |
59 | | -\method{encode( \optional{\var{encoding}} )} method that returns an |
60 | | -8-bit string in the desired encoding. Encodings are named by strings, |
61 | | -such as \code{'ascii'}, \code{'utf-8'}, \code{'iso-8859-1'}, or |
62 | | -whatever. A codec API is defined for implementing and registering new |
63 | | -encodings that are then available throughout a Python program. If an |
64 | | -encoding isn't specified, the default encoding is usually 7-bit ASCII, |
65 | | -though it can be changed for your Python installation by calling the |
| 58 | +type. They can be indexed and sliced, but not modified in place. |
| 59 | +Unicode strings have an \method{encode( \optional{\var{encoding}} )} method |
| 60 | +that returns an 8-bit string in the desired encoding. Encodings are |
| 61 | +named by strings, such as \code{'ascii'}, \code{'utf-8'}, |
| 62 | +\code{'iso-8859-1'}, or whatever. A codec API is defined for |
| 63 | +implementing and registering new encodings that are then available |
| 64 | +throughout a Python program. If an encoding isn't specified, the |
| 65 | +default encoding is usually 7-bit ASCII, though it can be changed for |
| 66 | +your Python installation by calling the |
66 | 67 | \function{sys.setdefaultencoding(\var{encoding})} function in a |
67 | 68 | customized version of \file{site.py}. |
68 | 69 |
|
@@ -352,8 +353,8 @@ \section{Porting to 1.6} |
352 | 353 |
|
353 | 354 | Taking the \function{repr()} of a float now uses a different |
354 | 355 | formatting precision than \function{str()}. \function{repr()} uses |
355 | | -``%.17g'' format string for C's \function{sprintf()}, while |
356 | | -\function{str()} uses ``%.12g'' as before. The effect is that |
| 356 | +\code{\%.17g} format string for C's \function{sprintf()}, while |
| 357 | +\function{str()} uses \code{\%.12g} as before. The effect is that |
357 | 358 | \function{repr()} may occasionally show more decimal places than |
358 | 359 | \function{str()}, for numbers |
359 | 360 | For example, the number 8.1 can't be represented exactly in binary, so |
@@ -437,14 +438,18 @@ \section{Core Changes} |
437 | 438 | Win64 because it seems that for ease of porting, MS Visual C++ treats code |
438 | 439 | as 32 bit. |
439 | 440 | ) PythonWin also supports Windows CE; see the Python CE page at |
440 | | -\url{http://www.python.net/crew/mhammond/ce/} for more information. |
| 441 | +\url{http://starship.python.net/crew/mhammond/ce/} for more information. |
441 | 442 |
|
442 | 443 | An attempt has been made to alleviate one of Python's warts, the |
443 | 444 | often-confusing \exception{NameError} exception when code refers to a |
444 | 445 | local variable before the variable has been assigned a value. For |
445 | 446 | example, the following code raises an exception on the \keyword{print} |
446 | 447 | statement in both 1.5.2 and 1.6; in 1.5.2 a \exception{NameError} |
447 | | -exception is raised, while 1.6 raises \exception{UnboundLocalError}. |
| 448 | +exception is raised, while 1.6 raises a new |
| 449 | +\exception{UnboundLocalError} exception. |
| 450 | +\exception{UnboundLocalError} is a subclass of \exception{NameError}, |
| 451 | +so any existing code that expects \exception{NameError} to be raised |
| 452 | +should still work. |
448 | 453 |
|
449 | 454 | \begin{verbatim} |
450 | 455 | def f(): |
@@ -483,7 +488,7 @@ \section{Extending/Embedding Changes} |
483 | 488 |
|
484 | 489 | The \file{Python/importdl.c} file, which was a mass of \#ifdefs to |
485 | 490 | support dynamic loading on many different platforms, was cleaned up |
486 | | -are reorganized by Greg Stein. \file{importdl.c} is now quite small, |
| 491 | +and reorganized by Greg Stein. \file{importdl.c} is now quite small, |
487 | 492 | and platform-specific code has been moved into a bunch of |
488 | 493 | \file{Python/dynload_*.c} files. |
489 | 494 |
|
|
0 commit comments