From: A.M. K. <aku...@us...> - 2001-01-22 17:52:05
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv21556 Modified Files: python-21.tex Log Message: Add reference to PEP 232. Use correct flag name Py_TPFLAGS_CHECKTYPES Mention that numeric methods can return Py_NotImplemented (NAS) Mention optional arguments in time modules (TW) Various minor rewrites and additional attributions Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** python-21.tex 2001/01/22 16:15:44 1.2 --- python-21.tex 2001/01/22 17:52:19 1.3 *************** *** 67,70 **** --- 67,76 ---- object. + \begin{seealso} + + \seepep{232}{Function Attributes}{Written and implemented by Barry Warsaw.} + + \end{seealso} + % ====================================================================== \section{PEP 207: Rich Comparisons} *************** *** 268,272 **** Extension types can now set the type flag ! \code{Py_TPFLAGS_NEWSTYLENUMBER} in their \code{PyTypeObject} structure to indicate that they support the new coercion model. In such extension types, the numeric slot functions can no longer assume --- 274,278 ---- Extension types can now set the type flag ! \code{Py_TPFLAGS_CHECKTYPES} in their \code{PyTypeObject} structure to indicate that they support the new coercion model. In such extension types, the numeric slot functions can no longer assume *************** *** 278,282 **** of the other type will then be tried, and perhaps they can handle the operation; if the other type also returns \code{Py_NotImplemented}, ! then a \exception{TypeError} will be raised. \begin{seealso} --- 284,292 ---- of the other type will then be tried, and perhaps they can handle the operation; if the other type also returns \code{Py_NotImplemented}, ! then a \exception{TypeError} will be raised. Numeric methods written ! in Python can also return \code{Py_NotImplemented}, causing the ! interpreter to act as if the method did not exist (perhaps raising a ! \exception{TypeError}, perhaps trying another object's numeric ! methods). \begin{seealso} *************** *** 307,311 **** depending on how slow the C library's \function{getc()} was, but is around 66\%, and potentially much faster on some particular operating ! systems. A new module and method for file objects was also added, contributed --- 317,322 ---- depending on how slow the C library's \function{getc()} was, but is around 66\%, and potentially much faster on some particular operating ! systems. Tim Peters did much of the benchmarking and coding for this ! change, motivated by a discussion in comp.lang.python. A new module and method for file objects was also added, contributed *************** *** 313,318 **** the existing \function{xrange()} built-in. \function{xreadlines()} returns an opaque sequence object that only supports being iterated ! over, reading a line on every iteration but not reading the entire file into memory as ! the existing \method{readline()} method. You'd use it like this: \begin{verbatim} --- 324,330 ---- the existing \function{xrange()} built-in. \function{xreadlines()} returns an opaque sequence object that only supports being iterated ! over, reading a line on every iteration but not reading the entire ! file into memory as the existing \method{readline()} method. You'd ! use it like this: \begin{verbatim} *************** *** 322,326 **** \end{verbatim} ! For a fuller discussion of the line I/O changes, see the python-dev summary for January 1-15, 2001. \item \module{curses.panel}, a wrapper for the panel library, part of --- 334,339 ---- \end{verbatim} ! For a fuller discussion of the line I/O changes, see the python-dev ! summary for January 1-15, 2001. \item \module{curses.panel}, a wrapper for the panel library, part of *************** *** 357,360 **** --- 370,386 ---- \method{set_pasv(0)} on FTP objects to disable passive mode. + \item Various functions in the \module{time} module, such as + \function{asctime()} and \function{localtime()}, + require a floating point argument containing the time in seconds since + the epoch. The most common use of these functions is to work with the + current time, so the floating point argument has been made optional; + when a value isn't provided, the current time will be used. For + example, log file entries usually need a string containing the current + time; in Python 2.1, \code{time.asctime()} can be used, instead of the + lengthier \code{time.asctime(time.localtime(time.time()))} that was + previously required. + + This change was proposed and implemented by Thomas Wouters. + \end{itemize} *************** *** 368,372 **** The author would like to thank the following people for offering ! suggestions on various drafts of this article: no one yet! \end{document} --- 394,399 ---- The author would like to thank the following people for offering ! suggestions on various drafts of this article: Neil Schemenauer, ! Thomas Wouters. \end{document} |