|
3 | 3 |
|
4 | 4 | \title{What's New in Python 2.3} |
5 | 5 | \release{0.08} |
6 | | -\author{A.M. Kuchling} |
| 6 | +\author{A.M.\ Kuchling} |
7 | 7 | \authoraddress{ \email{ [email protected]}} |
8 | 8 |
|
9 | 9 | \begin{document} |
@@ -173,11 +173,11 @@ \section{PEP 255: Simple Generators\label{section-generators}} |
173 | 173 | the function will resume executing immediately after the |
174 | 174 | \keyword{yield} statement. (For complicated reasons, the |
175 | 175 | \keyword{yield} statement isn't allowed inside the \keyword{try} block |
176 | | -of a \code{try...finally} statement; read \pep{255} for a full |
| 176 | +of a \keyword{try}...\keyword{finally} statement; read \pep{255} for a full |
177 | 177 | explanation of the interaction between \keyword{yield} and |
178 | 178 | exceptions.) |
179 | 179 |
|
180 | | -Here's a sample usage of the \function{generate_ints} generator: |
| 180 | +Here's a sample usage of the \function{generate_ints()} generator: |
181 | 181 |
|
182 | 182 | \begin{verbatim} |
183 | 183 | >>> gen = generate_ints(3) |
@@ -472,7 +472,7 @@ \section{PEP 282: The \module{logging} Package} |
472 | 472 | There's also an \function{exception()} function that records the most |
473 | 473 | recent traceback. Any of the other functions will also record the |
474 | 474 | traceback if you specify a true value for the keyword argument |
475 | | -\code{exc_info}. |
| 475 | +\var{exc_info}. |
476 | 476 |
|
477 | 477 | \begin{verbatim} |
478 | 478 | def f(): |
@@ -510,7 +510,7 @@ \section{PEP 282: The \module{logging} Package} |
510 | 510 | Log records are usually propagated up the hierarchy, so a message |
511 | 511 | logged to \samp{server.auth} is also seen by \samp{server} and |
512 | 512 | \samp{root}, but a handler can prevent this by setting its |
513 | | -\member{propagate} attribute to \code{False}. |
| 513 | +\member{propagate} attribute to \constant{False}. |
514 | 514 |
|
515 | 515 | There are more classes provided by the \module{logging} package that |
516 | 516 | can be customized. When a \class{Logger} instance is told to log a |
@@ -683,10 +683,10 @@ \section{PEP 273: Importing Modules from Zip Archives} |
683 | 683 |
|
684 | 684 | An entry in \code{sys.path} can now be the filename of a ZIP archive. |
685 | 685 | The ZIP archive can contain any kind of files, but only files named |
686 | | -\code{*.py}, \code{*.pyc}, or \code{*.pyo} can be imported. If an |
687 | | -archive only contains \code{*.py} files, Python will not attempt to |
688 | | -modify the archive by adding the corresponding \code{*.pyc} file, meaning |
689 | | -that if a ZIP archive doesn't contain \code{*.pyc} files, importing may be |
| 686 | +\file{*.py}, \file{*.pyc}, or \file{*.pyo} can be imported. If an |
| 687 | +archive only contains \file{*.py} files, Python will not attempt to |
| 688 | +modify the archive by adding the corresponding \file{*.pyc} file, meaning |
| 689 | +that if a ZIP archive doesn't contain \file{*.pyc} files, importing may be |
690 | 690 | rather slow. |
691 | 691 |
|
692 | 692 | A path within the archive can also be specified to only import from a |
@@ -767,14 +767,14 @@ \section{PEP 302: New Import Hooks \label{section-pep302}} |
767 | 767 |
|
768 | 768 | \begin{itemize} |
769 | 769 | \item \code{sys.path_hooks} is a list of callable objects; most |
770 | | -often they'll be classes. Each callable takes a string containing |
771 | | -a path and either returns an importer object that will handle imports |
772 | | -from this path or raises an \exception{ImportError} exception if it |
773 | | -can't handle this path. |
| 770 | + often they'll be classes. Each callable takes a string containing a |
| 771 | + path and either returns an importer object that will handle imports |
| 772 | + from this path or raises an \exception{ImportError} exception if it |
| 773 | + can't handle this path. |
774 | 774 |
|
775 | 775 | \item \code{sys.path_importer_cache} caches importer objects for |
776 | | -each path, so \code{sys.path_hooks} will only need to be traversed |
777 | | -once for each path. |
| 776 | + each path, so \code{sys.path_hooks} will only need to be traversed |
| 777 | + once for each path. |
778 | 778 |
|
779 | 779 | \item \code{sys.meta_path} is a list of importer objects that will |
780 | 780 | be traversed before \code{sys.path} is checked. This list is |
@@ -927,8 +927,9 @@ \section{Extended Slices\label{section-slices}} |
927 | 927 |
|
928 | 928 | To simplify implementing sequences that support extended slicing, |
929 | 929 | slice objects now have a method \method{indices(\var{length})} which, |
930 | | -given the length of a sequence, returns a \code{(start, stop, step)} |
931 | | -tuple that can be passed directly to \function{range()}. |
| 930 | +given the length of a sequence, returns a \code{(\var{start}, |
| 931 | +\var{stop}, \var{step})} tuple that can be passed directly to |
| 932 | +\function{range()}. |
932 | 933 | \method{indices()} handles omitted and out-of-bounds indices in a |
933 | 934 | manner consistent with regular slices (and this innocuous phrase hides |
934 | 935 | a welter of confusing details!). The method is intended to be used |
@@ -1118,7 +1119,7 @@ \subsection{String Changes} |
1118 | 1119 |
|
1119 | 1120 | \begin{itemize} |
1120 | 1121 |
|
1121 | | -\item The \code{in} operator now works differently for strings. |
| 1122 | +\item The \keyword{in} operator now works differently for strings. |
1122 | 1123 | Previously, when evaluating \code{\var{X} in \var{Y}} where \var{X} |
1123 | 1124 | and \var{Y} are strings, \var{X} could only be a single character. |
1124 | 1125 | That's now changed; \var{X} can be a string of any length, and |
@@ -1405,7 +1406,8 @@ \section{New, Improved, and Deprecated Modules} |
1405 | 1406 |
|
1406 | 1407 | \item The \function{sample(\var{population}, \var{k})} function was |
1407 | 1408 | added to the \module{random} module. \var{population} is a sequence |
1408 | | -or \code{xrange} object containing the elements of a population, and \function{sample()} |
| 1409 | +or \class{xrange} object containing the elements of a population, and |
| 1410 | +\function{sample()} |
1409 | 1411 | chooses \var{k} elements from the population without replacing chosen |
1410 | 1412 | elements. \var{k} can be any value up to \code{len(\var{population})}. |
1411 | 1413 | For example: |
@@ -1933,7 +1935,7 @@ \section{Build and C API Changes} |
1933 | 1935 | \constant{METH_NOARGS} flag, signalling that there are no arguments, and |
1934 | 1936 | the argument checking can then be removed. If compatibility with |
1935 | 1937 | pre-2.2 versions of Python is important, the code could use |
1936 | | -\code{PyArg_ParseTuple(args, "")} instead, but this will be slower |
| 1938 | +\code{PyArg_ParseTuple(\var{args}, "")} instead, but this will be slower |
1937 | 1939 | than using \constant{METH_NOARGS}. |
1938 | 1940 |
|
1939 | 1941 | \item A new function, \cfunction{PyObject_DelItemString(\var{mapping}, |
|
0 commit comments