Fix typos and errors noticed by Skip Montanaro
This commit is contained in:
parent
c380466762
commit
662d76ee7b
|
@ -1,7 +1,7 @@
|
||||||
\documentclass{howto}
|
\documentclass{howto}
|
||||||
|
|
||||||
\title{What's New in Python 1.6}
|
\title{What's New in Python 1.6}
|
||||||
\release{0.02}
|
\release{0.03}
|
||||||
\author{A.M. Kuchling and Moshe Zadka}
|
\author{A.M. Kuchling and Moshe Zadka}
|
||||||
\authoraddress{\email{amk1@bigfoot.com}, \email{moshez@math.huji.ac.il} }
|
\authoraddress{\email{amk1@bigfoot.com}, \email{moshez@math.huji.ac.il} }
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
@ -55,14 +55,15 @@ escapes can be used for characters up to U+01FF, which is represented
|
||||||
by \code{\e 777}.
|
by \code{\e 777}.
|
||||||
|
|
||||||
Unicode strings, just like regular strings, are an immutable sequence
|
Unicode strings, just like regular strings, are an immutable sequence
|
||||||
type, so they can be indexed and sliced. They also have an
|
type. They can be indexed and sliced, but not modified in place.
|
||||||
\method{encode( \optional{\var{encoding}} )} method that returns an
|
Unicode strings have an \method{encode( \optional{\var{encoding}} )} method
|
||||||
8-bit string in the desired encoding. Encodings are named by strings,
|
that returns an 8-bit string in the desired encoding. Encodings are
|
||||||
such as \code{'ascii'}, \code{'utf-8'}, \code{'iso-8859-1'}, or
|
named by strings, such as \code{'ascii'}, \code{'utf-8'},
|
||||||
whatever. A codec API is defined for implementing and registering new
|
\code{'iso-8859-1'}, or whatever. A codec API is defined for
|
||||||
encodings that are then available throughout a Python program. If an
|
implementing and registering new encodings that are then available
|
||||||
encoding isn't specified, the default encoding is usually 7-bit ASCII,
|
throughout a Python program. If an encoding isn't specified, the
|
||||||
though it can be changed for your Python installation by calling the
|
default encoding is usually 7-bit ASCII, though it can be changed for
|
||||||
|
your Python installation by calling the
|
||||||
\function{sys.setdefaultencoding(\var{encoding})} function in a
|
\function{sys.setdefaultencoding(\var{encoding})} function in a
|
||||||
customized version of \file{site.py}.
|
customized version of \file{site.py}.
|
||||||
|
|
||||||
|
@ -352,8 +353,8 @@ digit.
|
||||||
|
|
||||||
Taking the \function{repr()} of a float now uses a different
|
Taking the \function{repr()} of a float now uses a different
|
||||||
formatting precision than \function{str()}. \function{repr()} uses
|
formatting precision than \function{str()}. \function{repr()} uses
|
||||||
``%.17g'' format string for C's \function{sprintf()}, while
|
\code{\%.17g} format string for C's \function{sprintf()}, while
|
||||||
\function{str()} uses ``%.12g'' as before. The effect is that
|
\function{str()} uses \code{\%.12g} as before. The effect is that
|
||||||
\function{repr()} may occasionally show more decimal places than
|
\function{repr()} may occasionally show more decimal places than
|
||||||
\function{str()}, for numbers
|
\function{str()}, for numbers
|
||||||
For example, the number 8.1 can't be represented exactly in binary, so
|
For example, the number 8.1 can't be represented exactly in binary, so
|
||||||
|
@ -437,14 +438,18 @@ processor, mostly by Trent Mick of ActiveState. (Confusingly, \code{sys.platfor
|
||||||
Win64 because it seems that for ease of porting, MS Visual C++ treats code
|
Win64 because it seems that for ease of porting, MS Visual C++ treats code
|
||||||
as 32 bit.
|
as 32 bit.
|
||||||
) PythonWin also supports Windows CE; see the Python CE page at
|
) PythonWin also supports Windows CE; see the Python CE page at
|
||||||
\url{http://www.python.net/crew/mhammond/ce/} for more information.
|
\url{http://starship.python.net/crew/mhammond/ce/} for more information.
|
||||||
|
|
||||||
An attempt has been made to alleviate one of Python's warts, the
|
An attempt has been made to alleviate one of Python's warts, the
|
||||||
often-confusing \exception{NameError} exception when code refers to a
|
often-confusing \exception{NameError} exception when code refers to a
|
||||||
local variable before the variable has been assigned a value. For
|
local variable before the variable has been assigned a value. For
|
||||||
example, the following code raises an exception on the \keyword{print}
|
example, the following code raises an exception on the \keyword{print}
|
||||||
statement in both 1.5.2 and 1.6; in 1.5.2 a \exception{NameError}
|
statement in both 1.5.2 and 1.6; in 1.5.2 a \exception{NameError}
|
||||||
exception is raised, while 1.6 raises \exception{UnboundLocalError}.
|
exception is raised, while 1.6 raises a new
|
||||||
|
\exception{UnboundLocalError} exception.
|
||||||
|
\exception{UnboundLocalError} is a subclass of \exception{NameError},
|
||||||
|
so any existing code that expects \exception{NameError} to be raised
|
||||||
|
should still work.
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
def f():
|
def f():
|
||||||
|
@ -483,7 +488,7 @@ This means you no longer have to remember to write code such as
|
||||||
|
|
||||||
The \file{Python/importdl.c} file, which was a mass of \#ifdefs to
|
The \file{Python/importdl.c} file, which was a mass of \#ifdefs to
|
||||||
support dynamic loading on many different platforms, was cleaned up
|
support dynamic loading on many different platforms, was cleaned up
|
||||||
are reorganized by Greg Stein. \file{importdl.c} is now quite small,
|
and reorganized by Greg Stein. \file{importdl.c} is now quite small,
|
||||||
and platform-specific code has been moved into a bunch of
|
and platform-specific code has been moved into a bunch of
|
||||||
\file{Python/dynload_*.c} files.
|
\file{Python/dynload_*.c} files.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue