From: A.M. K. <aku...@us...> - 2000-09-04 17:59:34
|
Update of /cvsroot/py-howto/pyhowto In directory slayer.i.sourceforge.net:/tmp/cvs-serv20875 Modified Files: python-2.0.tex Log Message: Various corrections pointed out by Detlef Lannert Index: python-2.0.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-2.0.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** python-2.0.tex 2000/08/30 12:55:42 1.26 --- python-2.0.tex 2000/09/04 17:59:27 1.27 *************** *** 2,6 **** \title{What's New in Python 2.0} ! \release{0.04} \author{A.M. Kuchling and Moshe Zadka} \authoraddress{\email{am...@bi...}, \email{mo...@ma...} } --- 2,6 ---- \title{What's New in Python 2.0} ! \release{0.05} \author{A.M. Kuchling and Moshe Zadka} \authoraddress{\email{am...@bi...}, \email{mo...@ma...} } *************** *** 82,87 **** \item \code{ord(\var{u})}, where \var{u} is a 1-character regular or Unicode string, returns the number of the character as an integer. ! \item \code{unicode(\var{string}, \optional{\var{encoding},} ! \optional{\var{errors}} ) } creates a Unicode string from an 8-bit string. \code{encoding} is a string naming the encoding to use. The \code{errors} parameter specifies the treatment of characters that --- 82,87 ---- \item \code{ord(\var{u})}, where \var{u} is a 1-character regular or Unicode string, returns the number of the character as an integer. ! \item \code{unicode(\var{string} \optional{, \var{encoding}} ! \optional{, \var{errors}} ) } creates a Unicode string from an 8-bit string. \code{encoding} is a string naming the encoding to use. The \code{errors} parameter specifies the treatment of characters that *************** *** 152,156 **** \begin{verbatim} ! input = UTF8_streamread( open( '/tmp/output', 'rb') ) print repr(input.read()) input.close() --- 152,156 ---- \begin{verbatim} ! input = UTF8_streamreader( open( '/tmp/output', 'rb') ) print repr(input.read()) input.close() *************** *** 273,281 **** Augmented assignment operators, another long-requested feature, have ! been added to Python 2.0. Augmented assignment operators include ! \code{+=}, \code{-=}, \code{*=}, and so forth. For example, the ! statement \code{a += 2} increments the value of the variable \code{a} ! by 2, equivalent to the slightly lengthier ! \code{a = a + 2}. The full list of supported assignment operators is \code{+=}, --- 273,280 ---- Augmented assignment operators, another long-requested feature, have ! been added to Python 2.0. Augmented assignment operators include ! \code{+=}, \code{-=}, \code{*=}, and so forth. For example, the ! statement \code{a += 2} increments the value of the variable ! \code{a} by 2, equivalent to the slightly lengthier \code{a = a + 2}. The full list of supported assignment operators is \code{+=}, *************** *** 313,317 **** Until now string-manipulation functionality was in the \module{string} ! Python module, which was usually a front-end for the \module{strop} module written in C. The addition of Unicode posed a difficulty for the \module{strop} module, because the functions would all need to be --- 312,316 ---- Until now string-manipulation functionality was in the \module{string} ! module, which was usually a front-end for the \module{strop} module written in C. The addition of Unicode posed a difficulty for the \module{strop} module, because the functions would all need to be *************** *** 446,455 **** The \keyword{print} statement can now have its output directed to a ! file-like object by following the \keyword{print} with \code{>> ! \var{fileobj}}, similar to the redirection operator in Unix shells. Previously you'd either have to use the \method{write()} method of the file-like object, which lacks the convenience and simplicity of ! \keyword{print}, or you could assign a new value to \code{sys.stdout} ! and then restore the old value. For sending output to standard error, it's much easier to write this: --- 445,454 ---- The \keyword{print} statement can now have its output directed to a ! file-like object by following the \keyword{print} with ! \verb|>> file|, similar to the redirection operator in Unix shells. Previously you'd either have to use the \method{write()} method of the file-like object, which lacks the convenience and simplicity of ! \keyword{print}, or you could assign a new value to ! \code{sys.stdout} and then restore the old value. For sending output to standard error, it's much easier to write this: *************** *** 536,542 **** contains the i-th element from each of the argument sequences. The difference between \function{zip()} and \code{map(None, \var{seq1}, ! \var{seq2})} is that \function{map()} raises an error if the sequences ! aren't all of the same length, while \function{zip()} truncates the ! returned list to the length of the shortest argument sequence. The \function{int()} and \function{long()} functions now accept an --- 535,542 ---- contains the i-th element from each of the argument sequences. The difference between \function{zip()} and \code{map(None, \var{seq1}, ! \var{seq2})} is that \function{map()} pads the sequences with ! \code{None} if the sequences aren't all of the same length, while ! \function{zip()} truncates the returned list to the length of the ! shortest argument sequence. The \function{int()} and \function{long()} functions now accept an *************** *** 552,556 **** \code{sys.version_info} would be \code{(2, 0, 1, 'beta', 1)}. \var{level} is a string such as \code{"alpha"}, \code{"beta"}, or ! \code{""} for a final release. Dictionaries have an odd new method, \method{setdefault(\var{key}, --- 552,556 ---- \code{sys.version_info} would be \code{(2, 0, 1, 'beta', 1)}. \var{level} is a string such as \code{"alpha"}, \code{"beta"}, or ! \code{"final"} for a final release. Dictionaries have an odd new method, \method{setdefault(\var{key}, *************** *** 610,614 **** argument form, many people wrote code which would break with the stricter checking. GvR backed out the changes in the face of public ! reaction, so for the\module{socket} module, the documentation was fixed and the multiple argument form is simply marked as deprecated; it \emph{will} be tightened up again in a future Python version. --- 610,614 ---- argument form, many people wrote code which would break with the stricter checking. GvR backed out the changes in the face of public ! reaction, so for the \module{socket} module, the documentation was fixed and the multiple argument form is simply marked as deprecated; it \emph{will} be tightened up again in a future Python version. *************** *** 632,638 **** wanted to print long integers that looked just like regular integers, since they had to go out of their way to chop off the character. This ! is no longer a problem in 2.0, but code which assumes the 'L' is ! there, and does \code{str(longval)[:-1]} will now lose the final ! digit. Taking the \function{repr()} of a float now uses a different --- 632,637 ---- wanted to print long integers that looked just like regular integers, since they had to go out of their way to chop off the character. This ! is no longer a problem in 2.0, but code which does \code{str(longval)[:-1]} and assumes the 'L' is there, will now lose ! the final digit. Taking the \function{repr()} of a float now uses a different *************** *** 641,645 **** \function{str()} uses \code{\%.12g} as before. The effect is that \function{repr()} may occasionally show more decimal places than ! \function{str()}, for numbers For example, the number 8.1 can't be represented exactly in binary, so \code{repr(8.1)} is \code{'8.0999999999999996'}, while str(8.1) is --- 640,644 ---- \function{str()} uses \code{\%.12g} as before. The effect is that \function{repr()} may occasionally show more decimal places than ! \function{str()}, for certain numbers. For example, the number 8.1 can't be represented exactly in binary, so \code{repr(8.1)} is \code{'8.0999999999999996'}, while str(8.1) is *************** *** 728,732 **** was no way to figure out automatically where Python is installed, or what compiler options to use for extension modules. Software authors ! had to go through an ardous ritual of editing Makefiles and configuration files, which only really work on Unix and leave Windows and MacOS unsupported. Software users faced wildly differing --- 727,731 ---- was no way to figure out automatically where Python is installed, or what compiler options to use for extension modules. Software authors ! had to go through an arduous ritual of editing Makefiles and configuration files, which only really work on Unix and leave Windows and MacOS unsupported. Software users faced wildly differing *************** *** 836,841 **** 8.3, and support for the older 7.x versions has been dropped. The Tkinter module now supports displaying Unicode strings in Tk widgets. ! Also, Fredrik Lundh contributed an optimization which make operations ! like \code{create_line} and \code{create_polygon} are much faster, especially when using lots of coordinates. --- 835,840 ---- 8.3, and support for the older 7.x versions has been dropped. The Tkinter module now supports displaying Unicode strings in Tk widgets. ! Also, Fredrik Lundh contributed an optimization which makes operations ! like \code{create_line} and \code{create_polygon} much faster, especially when using lots of coordinates. *************** *** 896,905 **** \item{\module{robotparser}:} Parse a \file{robots.txt} file, which is used for writing Web spiders that politely avoid certain areas of a ! Web site. The parser accepts the contents of a \file{robots.txt} file builds a set of rules from it, and can then answer questions about the fetchability of a given URL. (Contributed by Skip Montanaro.) \item{\module{tabnanny}:} A module/script to ! checks Python source code for ambiguous indentation. (Contributed by Tim Peters.) --- 895,904 ---- \item{\module{robotparser}:} Parse a \file{robots.txt} file, which is used for writing Web spiders that politely avoid certain areas of a ! Web site. The parser accepts the contents of a \file{robots.txt} file, builds a set of rules from it, and can then answer questions about the fetchability of a given URL. (Contributed by Skip Montanaro.) \item{\module{tabnanny}:} A module/script to ! check Python source code for ambiguous indentation. (Contributed by Tim Peters.) *************** *** 993,998 **** The authors would like to thank the following people for offering ! suggestions on drafts of this article: Fredrik Lundh, Skip ! Montanaro, Vladimir Marangozov, Guido van Rossum, Neil Schemenauer. \end{document} --- 992,998 ---- The authors would like to thank the following people for offering ! suggestions on drafts of this article: Mark Hammond, Fredrik Lundh, ! Detlef Lannert, Skip Montanaro, Vladimir Marangozov, Guido van Rossum, ! and Neil Schemenauer. \end{document} |