You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(11) |
Sep
(10) |
Oct
(11) |
Nov
(8) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(12) |
Feb
(7) |
Mar
(21) |
Apr
(5) |
May
(4) |
Jun
(1) |
Jul
(33) |
Aug
(5) |
Sep
(13) |
Oct
(16) |
Nov
(2) |
Dec
(6) |
2002 |
Jan
|
Feb
|
Mar
(6) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(1) |
2003 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: A.M. K. <aku...@us...> - 2001-03-27 21:40:22
|
Update of /cvsroot/py-howto/pyhowto/topic In directory usw-pr-cvs1:/tmp/cvs-serv4559/topic Log Message: Directory /cvsroot/py-howto/pyhowto/topic added to the repository |
From: A.M. K. <aku...@us...> - 2001-03-26 13:34:57
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv18454 Modified Files: python-21.tex Log Message: Note missing explanation Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** python-21.tex 2001/03/23 03:52:46 1.21 --- python-21.tex 2001/03/26 13:34:53 1.22 *************** *** 16,20 **** {\large This document is a draft, and is subject to change until the final version of Python 2.1 is released. Currently it is up to date ! for Python 2.1 beta 1. Please send any comments, bug reports, or questions, no matter how minor, to \email{am...@bi...}. } --- 16,20 ---- {\large This document is a draft, and is subject to change until the final version of Python 2.1 is released. Currently it is up to date ! for Python 2.1 beta 2. Please send any comments, bug reports, or questions, no matter how minor, to \email{am...@bi...}. } *************** *** 800,804 **** \item A new method, \method{popitem()}, was added to dictionaries to enable destructively iterating through the contents of a dictionary; ! this can be faster for large dictionaries because . \code{D.popitem()} removes a random \code{(\var{key}, \var{value})} pair from the dictionary and returns it as a 2-tuple. This was --- 800,804 ---- \item A new method, \method{popitem()}, was added to dictionaries to enable destructively iterating through the contents of a dictionary; ! this can be faster for large dictionaries because XXX. \code{D.popitem()} removes a random \code{(\var{key}, \var{value})} pair from the dictionary and returns it as a 2-tuple. This was |
From: Moshe Z. <mo...@us...> - 2001-03-25 20:05:27
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv16918 Modified Files: doanddont.tex Log Message: Adding section about backslashes Index: doanddont.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/doanddont.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** doanddont.tex 2001/03/23 18:25:21 1.3 --- doanddont.tex 2001/03/25 20:05:22 1.4 *************** *** 90,93 **** --- 90,120 ---- the rest of your code. Simply do not do that. + Bad examples: + + \begin{verbatim} + >>> for name in sys.argv[1:]: + >>> exec "%s=1" % name + >>> def func(s, **kw): + >>> for var, val in kw.items(): + >>> exec "s.%s=val" % var # invalid! + >>> execfile("handler.py") + >>> handle() + \end{verbatim} + + Good examples: + + \begin{verbatim} + >>> d = {} + >>> for name in sys.argv[1:]: + >>> d[name] = 1 + >>> def func(s, **kw): + >>> for var, val in kw.items(): + >>> setattr(s, var, val) + >>> d={} + >>> execfile("handle.py", d, d) + >>> handle = d['handle'] + >>> handle() + \end{verbatim} + \subsection{from module import name1, name2} *************** *** 100,103 **** --- 127,154 ---- one module is reloaded, or changes the definition of a function at runtime. + Bad example: + + \begin{verbatim} + # foo.py + a = 1 + + # bar.py + from foo import a + if something(): + a = 2 # danger: foo.a != a + \end{verbatim} + + Good example: + + \begin{verbatim} + # foo.py + a = 1 + + # bar.py + import foo + if something(): + foo.a = 2 + \end{verbatim} + \subsection{except:} *************** *** 256,259 **** --- 307,343 ---- suited to parsing --- assuming you are ready to deal with the \exception{ValueError} they raise. + + \section{Using Backslash to Continue Statements} + + Since Python treats a newline as a statement terminator, + and since statements are often more then is comfortable to put + in one line, many people do: + + \begin{verbatim} + if foo.bar()['first'][0] == baz.quux(1, 2)[5:9] and \ + calculate_number(10, 20) != forbulate(500, 360): + pass + \end{verbatim} + + You should realize that this is dangerous: a stray space after the + \code{\\} would make this line wrong, and stray spaces are notoriously + hard to see in editors. In this case, at least it would be a syntax + error, but if the code was: + + \begin{verbatim} + value = foo.bar()['first'][0]*baz.quux(1, 2)[5:9] \ + + calculate_number(10, 20)*forbulate(500, 360) + \end{verbatim} + + then it would just be subtly wrong. + + It is usually much better to use the implicit continuation inside parenthesis: + + This version is bulletproof: + + \begin{verbatim} + value = (foo.bar()['first'][0]*baz.quux(1, 2)[5:9] + + calculate_number(10, 20)*forbulate(500, 360)) + \end{verbatim} \end{document} |
From: Moshe Z. <mo...@us...> - 2001-03-23 18:37:42
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv14881 Modified Files: doanddont.tex Log Message: Fixed typo Index: doanddont.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/doanddont.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** doanddont.tex 2001/03/23 18:09:40 1.2 --- doanddont.tex 2001/03/23 18:25:21 1.3 *************** *** 199,203 **** to {\em its} caller. ! The last version is not very good either --- do to implementation details, the file would not be closed when an exception is raised until the handler finishes, and perhaps not at all in non-C implementations (e.g., Jython). --- 199,203 ---- to {\em its} caller. ! The last version is not very good either --- due to implementation details, the file would not be closed when an exception is raised until the handler finishes, and perhaps not at all in non-C implementations (e.g., Jython). |
From: Moshe Z. <mo...@us...> - 2001-03-23 18:09:49
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv12387 Modified Files: doanddont.tex Log Message: Clarified except: example. Thanks, Shaleh and Jerji Index: doanddont.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/doanddont.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** doanddont.tex 2001/03/20 21:13:18 1.1 --- doanddont.tex 2001/03/23 18:09:40 1.2 *************** *** 120,123 **** --- 120,132 ---- this has nothing to do with the readability of \code{"file"}. + The example above is better written + + \begin{verbatim} + try: + foo = opne("file") # will be changed to "open" as soon as we run it + except IOError: + sys.exit("could not open file") + \end{verbatim} + There are some situations in which the \code{except:} clause is useful: for example, in a framework when running callbacks, it is good not to |
From: A.M. K. <aku...@us...> - 2001-03-23 03:52:49
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv14496 Modified Files: python-21.tex Log Message: Add a paragraph about obmalloc turning up bugs in extension modules Mention the new ports Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** python-21.tex 2001/03/23 03:29:08 1.20 --- python-21.tex 2001/03/23 03:52:46 1.21 *************** *** 752,758 **** requests from these pools. It can be enabled by providing the \longprogramopt{with-pymalloc} option to the \program{configure} script; see ! \file{Objects/obmalloc.c} for the implementation details. ! Contributed by Vladimir Marangozov. \item The speed of line-oriented file I/O has been improved because people often complain about its lack of speed, and because it's often --- 752,774 ---- requests from these pools. It can be enabled by providing the \longprogramopt{with-pymalloc} option to the \program{configure} script; see ! \file{Objects/obmalloc.c} for the implementation details. + Authors of C extension modules should test their code with the object + allocator enabled, because some incorrect code may break, causing core + dumps at runtime. There are a bunch of memory allocation functions in + Python's C API that have previously been just aliases for the C + library's \function{malloc()} and \function{free()}, meaning that if + you accidentally called mismatched functions, the error wouldn't be + noticeable. When the object allocator is enabled, these functions + aren't aliases of \function{malloc()} and \function{free()} any more, + and calling the wrong function to free memory will get you a core + dump. For example, if memory was allocated using + \function{PyMem_New()}, it has to be freed using + \function{PyMem_Del()}, not \function{free()}. A few modules included + with Python fell afoul of this and had to be fixed; doubtless there + are more third-party modules that will have the same problem. + + The object allocator was contributed by Vladimir Marangozov. + \item The speed of line-oriented file I/O has been improved because people often complain about its lack of speed, and because it's often *************** *** 827,830 **** --- 843,849 ---- \item The size of the Unicode character database was shrunk by another 340K thanks to Fredrik Lundh. + + \item Some new ports were contributed: MacOS X (by Steven Majewski), + Cygwin (by Jason Tishler); RISCOS (by Dietmar Schwertberger). \end{itemize} |
From: A.M. K. <aku...@us...> - 2001-03-23 03:29:11
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv12482 Modified Files: python-21.tex Log Message: Add section for PEP 241 Add PyUnit and sys.excepthook Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** python-21.tex 2001/03/10 16:49:07 1.19 --- python-21.tex 2001/03/23 03:29:08 1.20 *************** *** 1,8 **** \documentclass{howto} % $Id$ \title{What's New in Python 2.1} ! \release{0.06} \author{A.M. Kuchling} \authoraddress{\email{am...@bi...}} --- 1,10 ---- \documentclass{howto} + \usepackage{distutils} + % $Id$ \title{What's New in Python 2.1} ! \release{0.07} \author{A.M. Kuchling} \authoraddress{\email{am...@bi...}} *************** *** 455,458 **** --- 457,502 ---- %====================================================================== + \section{PEP 232: Function Attributes} + + In Python 2.1, functions can now have arbitrary information attached + to them. People were often using docstrings to hold information about + functions and methods, because the \code{__doc__} attribute was the + only way of attaching any information to a function. For example, in + the Zope Web application server, functions are marked as safe for + public access by having a docstring, and in John Aycock's SPARK + parsing framework, docstrings hold parts of the BNF grammar to be + parsed. This overloading is unfortunate, since docstrings are really + intended to hold a function's documentation; for example, it means you + can't properly document functions intended for private use in Zope. + + Arbitrary attributes can now be set and retrieved on functions using the + regular Python syntax: + + \begin{verbatim} + def f(): pass + + f.publish = 1 + f.secure = 1 + f.grammar = "A ::= B (C D)*" + \end{verbatim} + + The dictionary containing attributes can be accessed as the function's + \member{__dict__}. Unlike the \member{__dict__} attribute of class + instances, in functions you can actually assign a new dictionary to + \member{__dict__}, though the new value is restricted to a regular + Python dictionary; you \emph{can't} be tricky and set it to a + \class{UserDict} instance, or any other random object that behaves + like a mapping. + + \begin{seealso} + + \seepep{232}{Function Attributes}{Written and implemented by Barry + Warsaw.} + + \end{seealso} + + + %====================================================================== + \section{PEP 235: Case-Insensitive Platforms and \keyword{import}} *************** *** 476,480 **** When using the Python interpreter interactively, the output of commands is displayed using the built-in \function{repr()} function. ! In Python 2.1, the variable \module{sys.displayhook} can be set to a callable object which will be called instead of \function{repr()}. For example, you can set it to a special pretty-printing function: --- 520,524 ---- When using the Python interpreter interactively, the output of commands is displayed using the built-in \function{repr()} function. ! In Python 2.1, the variable \function{sys.displayhook} can be set to a callable object which will be called instead of \function{repr()}. For example, you can set it to a special pretty-printing function: *************** *** 535,538 **** --- 579,626 ---- %====================================================================== + \section{PEP 241: Metadata in Python Packages} + + A common complaint from Python users is that there's no single catalog + of all the Python modules in existence. T.~Middleton's Vaults of + Parnassus at \url{http://www.vex.net/parnassus} are the largest + catalog of Python modules, but registering software at the Vaults is + optional, and many people don't bother. + + As a first small step toward fixing the problem, Python software + packaged using the Distutils \command{sdist} command will include a + file named \file{PKG-INFO} containing information about the package + such as its name, version, and author (metadata, in cataloguing + terminology). PEP 241 contains the full list of fields that can be + present in the \file{PKG-INFO} file. As people began to package their + software using Python 2.1, more and more packages will include + metadata, making it possible to build automated cataloguing systems + and experiment with them. With the result experience, perhaps it'll + be possible to design a really good catalog and then build support for + it into Python 2.2. For example, the Distutils \command{sdist} + and \command{bdist_*} commands could support a \option{upload} option + that would automatically upload your package to a catalog server. + + You can start creating packages containing \file{PKG-INFO} even if + you're not using Python 2.1, since a new release of the Distutils will + be made for users of earlier Python versions. Version 1.0.2 of the + Distutils includes the changes described in PEP 241, as well as + various bugfixes and enhancements. It will be available from + the Distutils SIG at \url{http://www.python.org/sigs/distutils-sig}. + + % XXX update when I actually release 1.0.2 + + \begin{seealso} + + \seepep{241}{Metadata for Python Software Packages}{Written and + implemented by A.M. Kuchling.} + + \seepep{243}{Module Repository Upload Mechanism}{Written by Sean + Reifschneider, this draft PEP describes a proposed mechanism for uploading + Python packages to a central server. + } + + \end{seealso} + + %====================================================================== \section{New and Improved Modules} *************** *** 565,571 **** \file{pydoc} quickly becomes addictive; try it out! ! \item The \module{doctest} module provides a testing framework based ! on running embedded examples in docstrings and comparing the results ! against the expected output. Contributed by Tim Peters. \item The \module{difflib} module contains a class, --- 653,665 ---- \file{pydoc} quickly becomes addictive; try it out! ! \item Two different modules for unit testing were added to the ! standard library. The \module{doctest} module, contributed by Tim ! Peters, provides a testing framework based on running embedded ! examples in docstrings and comparing the results against the expected ! output. PyUnit, contributed by Steve Purcell, is a unit testing ! framework inspired by JUnit, which was in turn an adaptation of Kent ! Beck's Smalltalk testing framework. See ! \url{http://pyunit.sourceforge.net/} for more information about ! PyUnit. \item The \module{difflib} module contains a class, *************** *** 589,592 **** --- 683,696 ---- any encoding supported by Python, and various bugfixes for SAX, DOM, and the \module{minidom} module. + + \item Ping also contributed another hook for handling uncaught + exceptions. \function{sys.excepthook} can be set to a callable + object. When an exception isn't caught by any + \keyword{try}...\keyword{except} blocks, the exception will be passed + to \function{sys.excepthook}, which can then do whatever it likes. At + the Ninth Python Conference, Ping demonstrated an application for this + hook: printing an extended traceback that not only lists the stack + frames, but also lists the function arguments and the local variables + for each frame. \item Various functions in the \module{time} module, such as |
From: A.M. K. <aku...@us...> - 2001-03-21 01:14:41
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv6896 Modified Files: xml-howto.tex Log Message: Correct my address Index: xml-howto.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/xml-howto.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** xml-howto.tex 2000/12/06 20:19:15 1.9 --- xml-howto.tex 2001/03/21 01:17:00 1.10 *************** *** 9,13 **** \author{The Python/XML Special Interest Group} ! \authoraddress{\email{xm...@py...}\break (edited by \email{aku...@ac...})} \begin{document} --- 9,13 ---- \author{The Python/XML Special Interest Group} ! \authoraddress{\email{xm...@py...}\break (edited by \email{am...@bi...})} \begin{document} |
From: Moshe Z. <mo...@us...> - 2001-03-20 21:11:02
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv4604 Added Files: doanddont.tex Log Message: A HOWTO about using Python correctly. --- NEW FILE --- \documentclass{howto} \title{Idioms and Anti-Idioms in Python} \release{0.00} \author{Moshe Zadka} \authoraddress{ho...@za...} \begin{document} \maketitle This document is placed in the public doman. \begin{abstract} \noindent This document can be considered a companion to the tutorial. It shows how to use Python, and even more importantly, how {\em not} to use Python. \end{abstract} \tableofcontents \section{Language Constructs You Should Not Use} While Python has relatively few gotchas compared to other languages, it still has some constructs which are only useful in corner cases, or are plain dangerous. \subsection{from module import *} \subsubsection{Inside Function Definitions} \code{from module import *} is {\em invalid} inside function definitions. While many versions of Python do no check for the invalidity, it does not make it more valid, no more then having a smart lawyer makes a man innocent. Do not use it like that ever. Even in versions where it was accepted, it made the function execution slower, because the compiler could not be certain which names are local and which are global. In Python 2.1 this construct causes warnings, and sometimes even errors. \subsubsection{At Module Level} While it is valid to use \code{from module import *} at module level it is usually a bad idea. For one, this loses an important property Python otherwise has --- you can know where each toplevel name is defined by a simple "search" function in your favourite editor. You also open yourself to trouble in the future, if some module grows additional functions or classes. One of the most awful question asked on the newsgroup is why this code: \begin{verbatim} f = open("www") f.read() \end{verbatim} does not work. Of course, it works just fine (assuming you have a file called "www".) But it does not work if somewhere in the module, the statement \code{from os import *} is present. The \module{os} module has a function called \function{open()} which returns an integer. While it is very useful, shadowing builtins is one of its least useful properties. Remember, you can never know for sure what names a module exports, so either take what you need --- \code{from module import name1, name2}, or keep them in the module and access on a per-need basis --- \code{import module;print module.name}. \subsubsection{When It Is Just Fine} There are situations in which \code{from module import *} is just fine: \begin{itemize} \item The interactive prompt. For example, \code{from math import *} makes Python an amazing scientific calculator. \item When extending a module in C with a module in Python. \item When the module advertises itself as \code{from import *} safe. \end{itemize} \subsection{Unadorned \keyword{exec}, \function{execfile} and friends} The word ``unadorned'' refers to the use without an explicit dictionary, in which case those constructs evaluate code in the {\em current} environment. This is dangerous for the same reasons \code{from import *} is dangerous --- it might step over variables you are counting on and mess up things for the rest of your code. Simply do not do that. \subsection{from module import name1, name2} This is a ``don't'' which is much weaker then the previous ``don't''s but is still something you should not do if you don't have good reasons to do that. The reason it is usually bad idea is because you suddenly have an object which lives in two seperate namespaces. When the binding in one namespace changes, the binding in the other will not, so there will be a discrepancy between them. This happens when, for example, one module is reloaded, or changes the definition of a function at runtime. \subsection{except:} Python has the \code{except:} clause, which catches all exceptions. Since {\em every} error in Python raises an exception, this makes many programming errors look like runtime problems, and hinders the debugging process. The following code shows a great example: \begin{verbatim} try: foo = opne("file") # misspelled "open" except: sys.exit("could not open file!") \end{verbatim} The second line triggers a \exception{NameError} which is caught by the except clause. The program will exit, and you will have no idea that this has nothing to do with the readability of \code{"file"}. There are some situations in which the \code{except:} clause is useful: for example, in a framework when running callbacks, it is good not to let any callback disturb the framework. \section{Exceptions} Exceptions are a useful feature of Python. You should learn to raise them whenever something unexpected occurs, and catch them only where you can do something about them. The following is a very popular anti-idiom \begin{verbatim} def get_status(file): if not os.path.exists(file): print "file not found" sys.exit(1) return open(file).readline() \end{verbatim} Consider the case the file gets deleted between the time the call to \function{os.path.exists} is made and the time \function{open} is called. That means the last line will throw an \exception{IOError}. The same would happen if \var{file} exists but has no read permission. Since testing this on a normal machine on existing and non-existing files make it seem bugless, that means in testing the results will seem fine, and the code will get shipped. Then an unhandled \exception{IOError} escapes to the user, who has to watch the ugly traceback. Here is a better way to do it. \begin{verbatim} def get_status(file): try: return open(file).readline() except (IOError, OSError): print "file not found" sys.exit(1) \end{verbatim} In this version, *either* the file gets opened and the line is read (so it works even on flaky NFS or SMB connections), or the message is printed and the application aborted. Still, \function{get_status} makes too many assumptions --- that it will only be used in a short running script, and not, say, in a long running server. Sure, the caller could do something like \begin{verbatim} try: status = get_status(log) except SystemExit: status = None \end{verbatim} So, try to make as few \code{except} clauses in your code --- those will usually be a catch-all in the \function{main}, or inside calls which should always succeed. So, the best version is probably \begin{verbatim} def get_status(file): return open(file).readline() \end{verbatim} The caller can deal with the exception if it wants (for example, if it tries several files in a loop), or just let the exception filter upwards to {\em its} caller. The last version is not very good either --- do to implementation details, the file would not be closed when an exception is raised until the handler finishes, and perhaps not at all in non-C implementations (e.g., Jython). \begin{verbatim} def get_status(file): fp = open(file) try: return fp.readline() finally: fp.close() \end{verbatim} \section{Using the Batteries} Every so often, people seem to be writing stuff in the Python library again, usually poorly. While the occasional module has a poor interface, it is usually much better to use the rich standard library and data types that come with Python then inventing your own. A useful module very few people know about is \module{os.path}. It always has the correct path arithmetic for your operating system, and will usually be much better then whatever you come up with yourself. Compare: \begin{verbatim} # ugh! return dir+"/"+file # better return os.path.join(dir, file) \end{verbatim} More useful functions in \module{os.path}: \function{basename}, \function{dirname} and \function{splitext}. There are also many useful builtin functions people seem not to be aware of for some reason: \function{min()} and \function{max()} can find the minimum/maximum of any sequence with comparable semantics, for example, yet many people write they own max/min. Another highly useful function is \function{reduce()}. Classical use of \function{reduce()} is something like \begin{verbatim} import sys, operator nums = map(float, sys.argv[1:]) print reduce(operator.add, nums)/len(nums) \end{verbatim} This cute little script prints the average of all numbers given on the command line. The \function{reduce()} adds up all the numbers, and the rest is just some pre- and postprocessing. On the same note, note that \function{float()}, \function{int()} and \function{long()} all accept arguments of type string, and so are suited to parsing --- assuming you are ready to deal with the \exception{ValueError} they raise. \end{document} |
From: A.M. K. <aku...@us...> - 2001-03-10 16:47:19
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv21672 Modified Files: python-21.tex Log Message: Fix a further markup problem noted by FLD Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** python-21.tex 2001/03/03 03:25:04 1.18 --- python-21.tex 2001/03/10 16:49:07 1.19 *************** *** 647,651 **** to get large pools of memory, and then fulfills smaller memory requests from these pools. It can be enabled by providing the ! \longprogramopt{--with-pymalloc} option to the \program{configure} script; see \file{Objects/obmalloc.c} for the implementation details. Contributed by Vladimir Marangozov. --- 647,651 ---- to get large pools of memory, and then fulfills smaller memory requests from these pools. It can be enabled by providing the ! \longprogramopt{with-pymalloc} option to the \program{configure} script; see \file{Objects/obmalloc.c} for the implementation details. Contributed by Vladimir Marangozov. |
From: A.M. K. <aku...@us...> - 2001-03-03 03:23:37
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv26887 Modified Files: python-21.tex Log Message: Discuss PEP 236. Update nested scope section. Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** python-21.tex 2001/03/02 21:19:38 1.17 --- python-21.tex 2001/03/03 03:25:04 1.18 *************** *** 91,95 **** variable within a function that contains further function definitions. This seems rather unlikely though, since such code would have been ! pretty confusing to read in the first place. One side effect of the change is that the \code{from \var{module} --- 91,95 ---- variable within a function that contains further function definitions. This seems rather unlikely though, since such code would have been ! pretty confusing to read in the first place. One side effect of the change is that the \code{from \var{module} *************** *** 127,130 **** --- 127,138 ---- poor design anyway). + Compatibility concerns have led to nested scopes being introduced + gradually; in Python 2.1, they aren't enabled by default, but can be + turned on within a module by using a future statement as described in + PEP 236. (See the following section for further discussion of PEP + 236.) In Python 2.2, nested scopes will become the default and there + will be no way to turn them off, but users will have had all of 2.1's + lifetime to fix any breakage resulting from their introduction. + \begin{seealso} *************** *** 137,142 **** %====================================================================== \section{PEP 236: \module{__future__} Directives} ! XXX %====================================================================== --- 145,177 ---- %====================================================================== \section{PEP 236: \module{__future__} Directives} + + The reaction to nested scopes was widespread concern about the dangers + of breaking code with the 2.1 release, and it was strong enough to + make the Pythoneers take a more conservative approach. This approach + consists of introducing a convention for enabling optional + functionality in release N that will become compulsory in release N+1. + + The syntax uses a \code{from...import} statement using the reserved + module name \module{__future__}. Nested scopes can be enabled by the + following statement: + + \begin{verbatim} + from __future__ import nested_scopes + \end{verbatim} ! While it looks like a normal \keyword{import} statement, it's not; ! there are strict rules on where such a future statement can be put. ! They can only be at the top of a module, and must precede any Python ! code or regular \keyword{import} statements. This is because such ! statements can affect how the Python bytecode compiler parses code and ! generates bytecode, so they must precede any statement that will ! result in bytecodes being produced. ! ! \begin{seealso} ! ! \seepep{236}{Back to the \module{__future__}}{Written by Tim Peters, ! and primarily implemented by Jeremy Hylton.} ! ! \end{seealso} %====================================================================== |
From: A.M. K. <aku...@us...> - 2001-03-02 21:18:12
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv29682 Modified Files: python-21.tex Log Message: Update estimate bug and patch counts Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** python-21.tex 2001/03/01 01:02:52 1.16 --- python-21.tex 2001/03/02 21:19:38 1.17 *************** *** 601,605 **** There were relatively few smaller changes made in Python 2.1 due to the shorter release cycle. A search through the CVS change logs turns ! up 57 patches applied, and 86 bugs fixed; both figures are likely to be underestimates. Some of the more notable changes are: --- 601,605 ---- There were relatively few smaller changes made in Python 2.1 due to the shorter release cycle. A search through the CVS change logs turns ! up 117 patches applied, and 136 bugs fixed; both figures are likely to be underestimates. Some of the more notable changes are: |
From: Fred L. D. Jr. <fd...@ac...> - 2001-03-01 03:52:42
|
A.M. Kuchling writes: > Fix markup nit pointed out by FLD ... > ! \longprogramopt{--with-pymalloc} option to the \program{configure} script; see Almost, but not quite. ;-) Remove the "--" from \longprogramopt; the formatting provides that for all formats. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Digital Creations |
From: A.M. K. <aku...@us...> - 2001-03-01 01:01:35
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv27536 Modified Files: python-21.tex Log Message: Fix markup nit pointed out by FLD Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** python-21.tex 2001/02/28 22:39:15 1.15 --- python-21.tex 2001/03/01 01:02:52 1.16 *************** *** 612,616 **** to get large pools of memory, and then fulfills smaller memory requests from these pools. It can be enabled by providing the ! "--with-pymalloc" option to the \file{configure} script; see \file{Objects/obmalloc.c} for the implementation details. Contributed by Vladimir Marangozov. --- 612,616 ---- to get large pools of memory, and then fulfills smaller memory requests from these pools. It can be enabled by providing the ! \longprogramopt{--with-pymalloc} option to the \program{configure} script; see \file{Objects/obmalloc.c} for the implementation details. Contributed by Vladimir Marangozov. |
From: Fred L. D. Jr. <fd...@ac...> - 2001-02-28 23:40:30
|
A.M. Kuchling writes: > + "--with-pymalloc" option to the \filename{configure} script; see \longprogramopt{with-pymalloc} \program{configure} -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Digital Creations |
From: A.M. K. <aku...@us...> - 2001-02-28 22:37:55
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv4227 Modified Files: python-21.tex Log Message: Add description of PEP235 Remove references to 2.1alpha Update description of PEP229 Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** python-21.tex 2001/02/28 22:22:40 1.14 --- python-21.tex 2001/02/28 22:39:15 1.15 *************** *** 35,41 **** more details about any new feature that particularly interests you. ! Currently 2.1 is available in an alpha release, but the release ! schedule calls for a beta release by late February 2001, and a final ! release in April 2001. %====================================================================== --- 35,40 ---- more details about any new feature that particularly interests you. ! Currently 2.1 is available in a beta release, and the final release is ! planned for April 2001. %====================================================================== *************** *** 309,331 **** Python source distribution is run at build time, and attempts to discover which modules can be enabled by examining the modules and ! header files on the system. In 2.1alpha1, there's very little you can ! do to change \file{setup.py}'s behaviour, or to discover why a given ! module isn't compiled. If you run into problems in 2.1alpha1, please ! report them, and be prepared to dive into \file{setup.py} in order to ! fix autodetection of a given library on your system. In the alpha2 ! release I plan to add ways to have more control over what the script ! does (probably command-line arguments to \file{configure} or to ! \file{setup.py}). ! ! If it turns out to be impossible to make autodetection work reliably, ! it's possible that this change may become an optional build method ! instead of the default, or it may even be backed out completely. In another far-reaching change to the build mechanism, Neil Schemenauer restructured things so Python now uses a single makefile that isn't recursive, instead of makefiles in the top directory and in ! each of the Python/, Parser/, Objects/, and Modules/ subdirectories. ! This makes building Python faster, and also makes the build process ! clearer and simpler. \begin{seealso} --- 308,323 ---- Python source distribution is run at build time, and attempts to discover which modules can be enabled by examining the modules and ! header files on the system. If a module is configured in ! \file{Modules/Setup}, the \file{setup.py} script won't attempt to ! compile that module and will defer to the \file{Modules/Setup} file's ! contents. This provides a way to specific any strange command-line ! flags or libraries that are required for a specific platform. In another far-reaching change to the build mechanism, Neil Schemenauer restructured things so Python now uses a single makefile that isn't recursive, instead of makefiles in the top directory and in ! each of the \file{Python/}, \file{Parser/}, \file{Objects/}, and ! \file{Modules/} subdirectories. This makes building Python faster ! and also makes hacking the Makefiles clearer and simpler. \begin{seealso} *************** *** 430,434 **** \section{PEP 235: Case-Insensitive Platforms and \keyword{import}} ! XXX %====================================================================== --- 422,438 ---- \section{PEP 235: Case-Insensitive Platforms and \keyword{import}} ! Some operating systems have filesystems that are case-insensitive, ! MacOS and Windows being the primary examples; on these systems, it's ! impossible to distinguish the filenames \samp{FILE.PY} and ! \samp{file.py}, even though they do store the file's name ! in its original case (they're case-preserving, too). ! ! In Python 2.1, the \keyword{import} statement will work to simulate ! case-sensitivity on case-insensitive platforms. Python will now ! search for the first case-sensitive match by default, raising an ! \exception{ImportError} if no such file is found, so \code{import file} ! will not import a module named \samp{FILE.PY}. Case-insensitive ! matching can be requested by setting the PYTHONCASEOK environment ! variable before starting the Python interpreter. %====================================================================== |
From: A.M. K. <aku...@us...> - 2001-02-28 22:21:20
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv1299 Modified Files: python-21.tex Log Message: Cover pydoc Update reference Python version to beta1 Rip out PEP 232 section Add placeholders for PEP 236 and 235 Fix erroneous \filename references Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** python-21.tex 2001/02/28 22:10:07 1.13 --- python-21.tex 2001/02/28 22:22:40 1.14 *************** *** 14,18 **** {\large This document is a draft, and is subject to change until the final version of Python 2.1 is released. Currently it is up to date ! for Python 2.1 alpha 2. Please send any comments, bug reports, or questions, no matter how minor, to \email{am...@bi...}. } --- 14,18 ---- {\large This document is a draft, and is subject to change until the final version of Python 2.1 is released. Currently it is up to date ! for Python 2.1 beta 1. Please send any comments, bug reports, or questions, no matter how minor, to \email{am...@bi...}. } *************** *** 137,179 **** %====================================================================== ! \section{PEP 232: Function Attributes} ! In Python 2.1, functions can now have arbitrary information attached ! to them. People were often using docstrings to hold information about ! functions and methods, because the \code{__doc__} attribute was the ! only way of attaching any information to a function. For example, in ! the Zope Web application server, functions are marked as safe for ! public access by having a docstring, and in John Aycock's SPARK ! parsing framework, docstrings hold parts of the BNF grammar to be ! parsed. This overloading is unfortunate, since docstrings are really ! intended to hold a function's documentation, and it means you can't ! properly document functions intended for private use in Zope. ! ! Attributes can now be set and retrieved on functions, using the ! regular Python syntax: ! ! \begin{verbatim} ! def f(): pass ! ! f.publish = 1 ! f.secure = 1 ! f.grammar = "A ::= B (C D)*" ! \end{verbatim} ! ! The dictionary containing attributes can be accessed as ! \member{__dict__}. Unlike the \member{__dict__} attribute of class ! instances, in functions you can actually assign a new dictionary to ! \member{__dict__}, though the new value is restricted to a regular ! Python dictionary; you can't be tricky and set it to a ! \class{UserDict} instance, a DBM file, or any other random mapping ! object. - \begin{seealso} - - \seepep{232}{Function Attributes}{Written and implemented by Barry - Warsaw.} - - \end{seealso} - %====================================================================== \section{PEP 207: Rich Comparisons} --- 137,144 ---- %====================================================================== ! \section{PEP 236: \module{__future__} Directives} ! XXX %====================================================================== \section{PEP 207: Rich Comparisons} *************** *** 463,466 **** --- 428,436 ---- %====================================================================== + \section{PEP 235: Case-Insensitive Platforms and \keyword{import}} + + XXX + + %====================================================================== \section{PEP 217: Interactive Display Hook} *************** *** 530,533 **** --- 500,529 ---- \begin{itemize} + \item Ka-Ping Yee contributed two new modules: \module{inspect.py}, a module for + getting information about live Python code, and \module{pydoc.py}, a + module for interactively converting docstrings to HTML or text. + As a bonus, \file{Tools/scripts/pydoc}, which is now automatically + installed, uses \module{pydoc.py} to display documentation given a Python module, package, or class name. For example, + \samp{pydoc xml.dom} displays the following: + + \begin{verbatim} + Python Library Documentation: package xml.dom in xml + + NAME + xml.dom - W3C Document Object Model implementation for Python. + + FILE + /usr/local/lib/python2.1/xml/dom/__init__.pyc + + DESCRIPTION + The Python mapping of the Document Object Model is documented in the + Python Library Reference in the section on the xml.dom package. + + This package contains the following modules: + ... + \end{verbatim} + + \file{pydoc} quickly becomes addictive; try it out! + \item The \module{doctest} module provides a testing framework based on running embedded examples in docstrings and comparing the results *************** *** 550,557 **** \item The PyXML package has gone through a few releases since Python 2.0, and Python 2.1 includes an updated version of the \module{xml} ! package. Some of the noteworthy changes include support for Expat ! 1.2, the ability for Expat parsers to handle files in any encoding ! supported by Python, and various bugfixes for SAX, DOM, and the ! \module{minidom} module. \item Various functions in the \module{time} module, such as --- 546,553 ---- \item The PyXML package has gone through a few releases since Python 2.0, and Python 2.1 includes an updated version of the \module{xml} ! package. Some of the noteworthy changes include support for Expat 1.2 ! and later versions, the ability for Expat parsers to handle files in ! any encoding supported by Python, and various bugfixes for SAX, DOM, ! and the \module{minidom} module. \item Various functions in the \module{time} module, such as *************** *** 597,601 **** %====================================================================== ! \section{Minor Changes and Fixes} There were relatively few smaller changes made in Python 2.1 due to --- 593,597 ---- %====================================================================== ! \section{Other Changes and Fixes} There were relatively few smaller changes made in Python 2.1 due to *************** *** 612,617 **** to get large pools of memory, and then fulfills smaller memory requests from these pools. It can be enabled by providing the ! "--with-pymalloc" option to the \filename{configure} script; see ! \filename{Objects/obmalloc.c} for the implementation details. Contributed by Vladimir Marangozov. --- 608,613 ---- to get large pools of memory, and then fulfills smaller memory requests from these pools. It can be enabled by providing the ! "--with-pymalloc" option to the \file{configure} script; see ! \file{Objects/obmalloc.c} for the implementation details. Contributed by Vladimir Marangozov. *************** *** 691,697 **** \end{itemize} ! And there's the usual list of bugfixes, minor memory leaks, docstring ! edits, and other tweaks, too lengthy to be worth itemizing; see the ! CVS logs for the full details if you want them. --- 687,693 ---- \end{itemize} ! And there's the usual list of minor bugfixes, minor memory leaks, ! docstring edits, and other tweaks, too lengthy to be worth itemizing; ! see the CVS logs for the full details if you want them. |
From: A.M. K. <aku...@us...> - 2001-02-28 22:08:47
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv32185 Modified Files: python-21.tex Log Message: Document the object allocator Minor sentence change Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** python-21.tex 2001/02/14 02:44:18 1.12 --- python-21.tex 2001/02/28 22:10:07 1.13 *************** *** 232,237 **** there's a new slot \code{tp_richcmp} in type objects and an API for performing a given rich comparison. I won't cover the C API here, but ! will refer you to PEP 207, or the documentation for Python's C API, ! for the full list of related functions. \begin{seealso} --- 232,237 ---- there's a new slot \code{tp_richcmp} in type objects and an API for performing a given rich comparison. I won't cover the C API here, but ! will refer you to PEP 207, or to 2.1's C API documentation, for the ! full list of related functions. \begin{seealso} *************** *** 605,608 **** --- 605,618 ---- \begin{itemize} + + + \item A specialized object allocator is now optionally available, that + should be faster than the system \function{malloc()} and have less + memory overhead. The allocator uses C's \function{malloc()} function + to get large pools of memory, and then fulfills smaller memory + requests from these pools. It can be enabled by providing the + "--with-pymalloc" option to the \filename{configure} script; see + \filename{Objects/obmalloc.c} for the implementation details. + Contributed by Vladimir Marangozov. \item The speed of line-oriented file I/O has been improved because |
From: A.M. K. <aku...@us...> - 2001-02-14 02:43:40
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv23762 Modified Files: python-21.tex Log Message: Finished the section on weak references Mentioned doctest, difflib, sys._getframe(), and the change to use PyImport_ImportModule() everywhere in C code No more XXX! Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** python-21.tex 2001/02/11 16:55:39 1.11 --- python-21.tex 2001/02/14 02:44:18 1.12 *************** *** 1,6 **** \documentclass{howto} - % XXX difflib.py, doctest.py added - % $Id$ --- 1,4 ---- *************** *** 95,109 **** This seems rather unlikely though, since such code would have been pretty confusing to read in the first place. ! One side effect of the change is that the statement from \code{from ! \var{module} import *} has been made illegal inside a function scope. ! The Python reference manual has said all along that \code{from ! \var{module} import *} is only legal at the top level of a module, but ! the CPython interpreter has never enforced this before; it will be ! enforced in 2.1, though it's not yet clear if it will be a syntax ! error or just a warning. In the alpha 2 release, it triggers a ! \exception{SyntaxError} exception, but this check might be made more ! lenient in following releases. ! % XXX update the previous sentence for 2.1final \begin{seealso} --- 93,130 ---- This seems rather unlikely though, since such code would have been pretty confusing to read in the first place. + + One side effect of the change is that the \code{from \var{module} + import *} and \keyword{exec} statements have been made illegal inside + a function scope under certain conditions. The Python reference + manual has said all along that \code{from \var{module} import *} is + only legal at the top level of a module, but the CPython interpreter + has never enforced this before. As part of the implementation of + nested scopes, the compiler which turns Python source into bytecodes + has to generate different code to access variables in a containing + scope. \code{from \var{module} import *} and \keyword{exec} make it + impossible for the compiler to figure this out, because they add names + to the local namespace that are unknowable at compile time. + Therefore, if a function contains function definitions or + \keyword{lambda} expressions with free variables, the compiler will + flag this by raising a \exception{SyntaxError} exception. + + To make the preceding explanation a bit clearer, here's an example: + + \begin{verbatim} + x = 1 + def f(): + # The next line is a syntax error + exec 'x=2' + def g(): + return x + \end{verbatim} ! Line 4 containing the \keyword{exec} statement is a syntax error, ! since \keyword{exec} would define a new local variable named \samp{x} ! whose value should be accessed by \function{g()}. ! ! This shouldn't be much of a limitation, since \keyword{exec} is rarely ! used in most Python code (and when it is used, it's often a sign of a ! poor design anyway). \begin{seealso} *************** *** 351,370 **** %====================================================================== ! \section{Weak References} ! Weak references are a minor but useful new data type in the Python ! programmer's toolbox. Storing a reference to an object (say, in a ! dictionary or a list) has the side effect of keeping that object alive ! forever. There are a few specific cases where this behaviour is ! undesirable, object caches being the most common one, and another ! being circular references in data structures such as trees. ! ! For example, a tree might be implemented as a set of \class{Node} ! instances where each instances contains a list of its children. If ! you need to be able to determine the parent of a given \class{Node}, ! an obvious solution would be to have each instance have a reference to ! its parent. This creates lots of circular references. ! XXX finish the rest of this section \begin{seealso} --- 372,457 ---- %====================================================================== ! \section{PEP 205: Weak References} ! ! Weak references, available through the \module{weakref} module, are a ! minor but useful new data type in the Python programmer's toolbox. ! ! Storing a reference to an object (say, in a dictionary or a list) has ! the side effect of keeping that object alive forever. There are a few ! specific cases where this behaviour is undesirable, object caches ! being the most common one, and another being circular references in ! data structures such as trees. ! ! For example, consider a memoizing function that caches the results of ! another function \function{f(\var{x})} by storing the function's ! argument and its result in a dictionary: ! ! \begin{verbatim} ! _cache = {} ! def memoize(x): ! if _cache.has_key(x): ! return _cache[x] ! ! retval = f(x) ! ! # Cache the returned object ! _cache[x] = retval ! ! return retval ! \end{verbatim} ! ! This version works for simple things such as integers, but it has a ! side effect; the \code{_cache} dictionary holds a reference to the ! return values, so they'll never be deallocated until the Python ! process exits and cleans up This isn't very noticeable for integers, ! but if \function{f()} returns an object, or a data structure that ! takes up a lot of memory, this can be a problem. ! ! Weak references provide a way to implement a cache that won't keep ! objects alive beyond their time. If an object is only accessible ! through weak references, the object will be deallocated and the weak ! references will now indicate that the object it referred to no longer ! exists. A weak reference to an object \var{obj} is created by calling ! \code{wr = weakref.ref(\var{obj})}. The object being referred to is ! returned by calling the weak reference as if it were a function: ! \code{wr()}. It will return the referenced object, or \code{None} if ! the object no longer exists. ! ! This makes it possible to write a \function{memoize()} function whose ! cache doesn't keep objects alive, by storing weak references in the ! cache. ! ! \begin{verbatim} ! _cache = {} ! def memoize(x): ! if _cache.has_key(x): ! obj = _cache[x]() ! # If weak reference object still exists, ! # return it ! if obj is not None: return obj ! ! retval = f(x) ! ! # Cache a weak reference ! _cache[x] = weakref.ref(retval) ! ! return retval ! \end{verbatim} ! The \module{weakref} module also allows creating proxy objects which ! behave like weak references --- an object referenced only by proxy ! objects is deallocated -- but instead of requiring an explicit call to ! retrieve the object, the proxy transparently forwards all operations ! to the object as long as the object still exists. If the object is ! deallocated, attempting to use a proxy will cause a ! \exception{weakref.ReferenceError} exception to be raised. ! \begin{verbatim} ! proxy = weakref.proxy(obj) ! proxy.attr # Equivalent to obj.attr ! proxy.meth() # Equivalent to obj.meth() ! del obj ! proxy.attr # raises weakref.ReferenceError ! \end{verbatim} \begin{seealso} *************** *** 443,446 **** --- 530,544 ---- \begin{itemize} + \item The \module{doctest} module provides a testing framework based + on running embedded examples in docstrings and comparing the results + against the expected output. Contributed by Tim Peters. + + \item The \module{difflib} module contains a class, + \class{SequenceMatcher}, which compares two sequences and computes the + changes required to transform one sequence into the other. For + example, this module can be used to write a tool similar to the Unix + \program{diff} program, and in fact the sample program + \file{Tools/scripts/ndiff.py} demonstrates how to write such a script. + \item \module{curses.panel}, a wrapper for the panel library, part of ncurses and of SYSV curses, was contributed by Thomas Gellekum. The *************** *** 483,487 **** --- 581,597 ---- \module{socket} module, contributed by Grant Edwards. + \item A new implementation-dependent function, \function{sys._getframe(\optional{depth})}, + has been added to return a given frame object from the current call stack. + \function{sys._getframe()} returns the frame at the top of the call stack; + if the optional integer argument \var{depth} is supplied, the function returns the frame + that is \var{depth} calls below the top of the stack. For example, \code{sys._getframe(1)} + returns the caller's frame object. + + This function is only present in CPython, not in Jython or the .NET + implementation. Use it for debugging, and resist the temptation to + put it into production code. + + \end{itemize} *************** *** 559,562 **** --- 669,678 ---- containing the filename and line number of the error, a pleasant side effect of the compiler reorganization done by Jeremy Hylton. + + \item C extensions which import other modules have been changed to use + \function{PyImport_ImportModule()}, which means that they will use any + import hooks that have been installed. This is also encouraged for + third-party extensions that need to import some other module from C + code. \item The size of the Unicode character database was shrunk by another |
From: A.M. K. <aku...@us...> - 2001-02-11 16:55:09
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv303 Modified Files: python-21.tex Log Message: Create separate section for changes to the standard library Make note about difflib and doctest Bump version number Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** python-21.tex 2001/02/05 02:47:52 1.10 --- python-21.tex 2001/02/11 16:55:39 1.11 *************** *** 1,8 **** \documentclass{howto} % $Id$ \title{What's New in Python 2.1} ! \release{0.05} \author{A.M. Kuchling} \authoraddress{\email{am...@bi...}} --- 1,10 ---- \documentclass{howto} + % XXX difflib.py, doctest.py added + % $Id$ \title{What's New in Python 2.1} ! \release{0.06} \author{A.M. Kuchling} \authoraddress{\email{am...@bi...}} *************** *** 437,440 **** --- 439,490 ---- %====================================================================== + \section{New and Improved Modules} + + \begin{itemize} + + \item \module{curses.panel}, a wrapper for the panel library, part of + ncurses and of SYSV curses, was contributed by Thomas Gellekum. The + panel library provides windows with the additional feature of depth. + Windows can be moved higher or lower in the depth ordering, and the + panel library figures out where panels overlap and which sections are + visible. + + \item The PyXML package has gone through a few releases since Python + 2.0, and Python 2.1 includes an updated version of the \module{xml} + package. Some of the noteworthy changes include support for Expat + 1.2, the ability for Expat parsers to handle files in any encoding + supported by Python, and various bugfixes for SAX, DOM, and the + \module{minidom} module. + + \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. + + \item The \module{ftplib} module now defaults to retrieving files in + passive mode, because passive mode is more likely to work from behind + a firewall. This request came from the Debian bug tracking system, + since other Debian packages use \module{ftplib} to retrieve files and + then don't work from behind a firewall. It's deemed unlikely that + this will cause problems for anyone, because Netscape defaults to + passive mode and few people complain, but if passive mode is + unsuitable for your application or network setup, call + \method{set_pasv(0)} on FTP objects to disable passive mode. + + \item Support for raw socket access has been added to the + \module{socket} module, contributed by Grant Edwards. + + + \end{itemize} + + %====================================================================== \section{Minor Changes and Fixes} *************** *** 481,491 **** suggestion and preliminary patch by Moshe Zadka. - \item \module{curses.panel}, a wrapper for the panel library, part of - ncurses and of SYSV curses, was contributed by Thomas Gellekum. The - panel library provides windows with the additional feature of depth. - Windows can be moved higher or lower in the depth ordering, and the - panel library figures out where panels overlap and which sections are - visible. - \item Modules can now control which names are imported when \code{from \var{module} import *} is used, by defining an \code{__all__} --- 531,534 ---- *************** *** 505,528 **** version was checked in. - \item The PyXML package has gone through a few releases since Python - 2.0, and Python 2.1 includes an updated version of the \module{xml} - package. Some of the noteworthy changes include support for Expat - 1.2, the ability for Expat parsers to handle files in any encoding - supported by Python, and various bugfixes for SAX, DOM, and the - \module{minidom} module. - - \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. - \item Applying \function{repr()} to strings previously used octal escapes for non-printable characters; for example, a newline was --- 548,551 ---- *************** *** 532,548 **** \code{\e t}, \code{\e r} escapes for the appropriate characters, and implemented this new formatting. - - \item The \module{ftplib} module now defaults to retrieving files in - passive mode, because passive mode is more likely to work from behind - a firewall. This request came from the Debian bug tracking system, - since other Debian packages use \module{ftplib} to retrieve files and - then don't work from behind a firewall. It's deemed unlikely that - this will cause problems for anyone, because Netscape defaults to - passive mode and few people complain, but if passive mode is - unsuitable for your application or network setup, call - \method{set_pasv(0)} on FTP objects to disable passive mode. - - \item Support for raw socket access has been added to the - \module{socket} module, contributed by Grant Edwards. \item Syntax errors detected at compile-time can now raise exceptions --- 555,558 ---- |
From: A.M. K. <aku...@us...> - 2001-02-05 02:47:41
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv13319 Modified Files: python-21.tex Log Message: Wrote section on nested scopes, and moved it to the front Began a section on weak references Various rewrites and paragraph refills Added: non-recursive makefiles, repr() of strings now uses \n, raw socket I/O Bumped version number Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** python-21.tex 2001/01/29 17:36:53 1.9 --- python-21.tex 2001/02/05 02:47:52 1.10 *************** *** 4,8 **** \title{What's New in Python 2.1} ! \release{0.04} \author{A.M. Kuchling} \authoraddress{\email{am...@bi...}} --- 4,8 ---- \title{What's New in Python 2.1} ! \release{0.05} \author{A.M. Kuchling} \authoraddress{\email{am...@bi...}} *************** *** 13,19 **** {\large This document is a draft, and is subject to change until ! Python 2.1 is released. Please send any comments, bug reports, or questions, ! no matter how minor, to \email{am...@bi...}. ! } It's that time again... time for a new Python release, version 2.1. --- 13,19 ---- {\large This document is a draft, and is subject to change until ! the final version of Python 2.1 is released. Currently it is up to date ! for Python 2.1 alpha 2. Please send any comments, bug reports, or ! questions, no matter how minor, to \email{am...@bi...}. } It's that time again... time for a new Python release, version 2.1. *************** *** 39,56 **** release in April 2001. ! % ====================================================================== \section{PEP 232: Function Attributes} ! In Python 2.1, functions can now have arbitrary ! information attached to them. People were often using docstrings to hold ! information about functions and methods, because the \code{__doc__} ! attribute was the only way of attaching any information to a function. ! For example, in the Zope Web application server, functions are marked ! as safe for public access by having a docstring, and in John Aycock's ! SPARK parsing framework, docstrings hold parts of the BNF grammar to ! be parsed. This overloading is unfortunate, since docstrings are ! really intended to hold a function's documentation, and it ! means you ! can't properly document functions intended for private use in Zope. Attributes can now be set and retrieved on functions, using the --- 39,129 ---- release in April 2001. ! %====================================================================== ! \section{PEP 227: Nested Scopes} ! ! The largest change in Python 2.1 is to Python's scoping rules. In ! Python 2.0, at any given time there are at most three namespaces used ! to look up variable names: local, module-level, and the built-in ! namespace. This often surprised people because it didn't match their ! intuitive expectations. For example, a nested recursive function ! definition doesn't work: ! ! \begin{verbatim} ! def f(): ! ... ! def g(value): ! ... ! return g(value-1) + 1 ! ... ! \end{verbatim} ! ! The function \function{g()} will always raise a \exception{NameError} ! exception, because the binding of the name \samp{g} isn't in either ! its local namespace or in the module-level namespace. This isn't much ! of a problem in practice (how often do you recursively define interior ! functions like this?), but this also made using the \keyword{lambda} ! statement clumsier, and this was a problem in practice. In code which ! uses \keyword{lambda} you can often find local variables being copied ! by passing them as the default values of arguments. ! ! \begin{verbatim} ! def find(self, name): ! "Return list of any entries equal to 'name'" ! L = filter(lambda x, name=name: x == name, ! self.list_attribute) ! return L ! \end{verbatim} ! ! The readability of Python code written in a strongly functional style ! suffers greatly as a result. ! ! The most significant change to Python 2.1 is that static scoping has ! been added to the language to fix this problem. As a first effect, ! the \code{name=name} default argument is now unnecessary in the above ! example. Put simply, when a given variable name is not assigned a ! value within a function (by an assignment, or the \keyword{def}, ! \keyword{class}, or \keyword{import} statements), references to the ! variable will be looked up in the local namespace of the enclosing ! scope. A more detailed explanation of the rules, and a dissection of ! the implementation, can be found in the PEP. ! ! This change may cause some compatibility problems for code where the ! same variable name is used both at the module level and as a local ! variable within a function that contains further function definitions. ! This seems rather unlikely though, since such code would have been ! pretty confusing to read in the first place. ! ! One side effect of the change is that the statement from \code{from ! \var{module} import *} has been made illegal inside a function scope. ! The Python reference manual has said all along that \code{from ! \var{module} import *} is only legal at the top level of a module, but ! the CPython interpreter has never enforced this before; it will be ! enforced in 2.1, though it's not yet clear if it will be a syntax ! error or just a warning. In the alpha 2 release, it triggers a ! \exception{SyntaxError} exception, but this check might be made more ! lenient in following releases. ! % XXX update the previous sentence for 2.1final ! ! \begin{seealso} ! ! \seepep{227}{Statically Nested Scopes}{Written and implemented by ! Jeremy Hylton.} ! ! \end{seealso} ! ! ! %====================================================================== \section{PEP 232: Function Attributes} ! In Python 2.1, functions can now have arbitrary information attached ! to them. People were often using docstrings to hold information about ! functions and methods, because the \code{__doc__} attribute was the ! only way of attaching any information to a function. For example, in ! the Zope Web application server, functions are marked as safe for ! public access by having a docstring, and in John Aycock's SPARK ! parsing framework, docstrings hold parts of the BNF grammar to be ! parsed. This overloading is unfortunate, since docstrings are really ! intended to hold a function's documentation, and it means you can't ! properly document functions intended for private use in Zope. Attributes can now be set and retrieved on functions, using the *************** *** 63,73 **** f.secure = 1 f.grammar = "A ::= B (C D)*" ! \end{verbatim} The dictionary containing attributes can be accessed as ! \member{__dict__}. Unlike the \member{__dict__} attribute of ! class instances, in functions you can actually assign a new dictionary ! to \member{__dict__}, though the new value is restricted to a ! regular Python dictionary; you can't be tricky and set it to a \class{UserDict} instance, a DBM file, or any other random mapping object. --- 136,146 ---- f.secure = 1 f.grammar = "A ::= B (C D)*" ! \end{verbatim} The dictionary containing attributes can be accessed as ! \member{__dict__}. Unlike the \member{__dict__} attribute of class ! instances, in functions you can actually assign a new dictionary to ! \member{__dict__}, though the new value is restricted to a regular ! Python dictionary; you can't be tricky and set it to a \class{UserDict} instance, a DBM file, or any other random mapping object. *************** *** 75,83 **** \begin{seealso} ! \seepep{232}{Function Attributes}{Written and implemented by Barry Warsaw.} \end{seealso} ! % ====================================================================== \section{PEP 207: Rich Comparisons} --- 148,157 ---- \begin{seealso} ! \seepep{232}{Function Attributes}{Written and implemented by Barry ! Warsaw.} \end{seealso} ! %====================================================================== \section{PEP 207: Rich Comparisons} *************** *** 96,112 **** the error. ! In Python 2.1, rich comparisons were added in order to support this need. ! Python classes can now individually overload each of the \code{<}, ! \code{<=}, \code{>}, \code{>=}, \code{==}, and \code{!=} operations. ! The new magic method names are: \begin{tableii}{c|l}{code}{Operation}{Method name} ! \lineii{<}{\method{__lt__}} ! \lineii{<=}{\method{__le__}} ! \lineii{>}{\method{__gt__}} ! \lineii{>=}{\method{__ge__}} ! \lineii{==}{\method{__eq__}} ! \lineii{!=}{\method{__ne__}} ! \end{tableii} (The magic methods are named after the corresponding Fortran operators --- 170,183 ---- the error. ! In Python 2.1, rich comparisons were added in order to support this ! need. Python classes can now individually overload each of the ! \code{<}, \code{<=}, \code{>}, \code{>=}, \code{==}, and \code{!=} ! operations. The new magic method names are: \begin{tableii}{c|l}{code}{Operation}{Method name} ! \lineii{<}{\method{__lt__}} \lineii{<=}{\method{__le__}} ! \lineii{>}{\method{__gt__}} \lineii{>=}{\method{__ge__}} ! \lineii{==}{\method{__eq__}} \lineii{!=}{\method{__ne__}} ! \end{tableii} (The magic methods are named after the corresponding Fortran operators *************** *** 144,152 **** \seepep{207}{Rich Comparisions}{Written by Guido van Rossum, heavily ! based on earlier work by David Ascher, and implemented by Guido van Rossum.} \end{seealso} ! % ====================================================================== \section{PEP 230: Warning Framework} --- 215,224 ---- \seepep{207}{Rich Comparisions}{Written by Guido van Rossum, heavily ! based on earlier work by David Ascher, and implemented by Guido van ! Rossum.} \end{seealso} ! %====================================================================== \section{PEP 230: Warning Framework} *************** *** 160,164 **** warning in the next version of Python. The following Python version can then drop the feature, and users will have had a full release ! cycle to remove uses of the old feature. Python 2.1 adds the warning framework to be used in this scheme. It --- 232,236 ---- warning in the next version of Python. The following Python version can then drop the feature, and users will have had a full release ! cycle to remove uses of the old feature. Python 2.1 adds the warning framework to be used in this scheme. It *************** *** 168,184 **** deprecate old features that they no longer wish to support. ! For example, in Python 2.1 the \module{regex} module is deprecated, ! so importing it causes a warning to be printed: \begin{verbatim} >>> import regex ! __main__:1: DeprecationWarning: the regex module is deprecated; please use the re module ! >>> \end{verbatim} ! Warnings can be issued by calling the \function{warnings.warn} function: \begin{verbatim} ! warnings.warn("feature X no longer supported") \end{verbatim} --- 240,258 ---- deprecate old features that they no longer wish to support. ! For example, in Python 2.1 the \module{regex} module is deprecated, so ! importing it causes a warning to be printed: \begin{verbatim} >>> import regex ! __main__:1: DeprecationWarning: the regex module ! is deprecated; please use the re module ! >>> \end{verbatim} ! Warnings can be issued by calling the \function{warnings.warn} ! function: \begin{verbatim} ! warnings.warn("feature X no longer supported") \end{verbatim} *************** *** 202,221 **** This adds a filter that will apply only to warnings of the class ! \class{DeprecationWarning} triggered in the \module{__main__} module, and applies a regular expression to only match the message about the \module{regex} module being deprecated, and will cause such warnings to be ignored. Warnings can also be printed only once, printed every time the offending code is executed, or turned into exceptions that will cause the program to stop (unless the exceptions are caught in the usual way, of course). Functions were also added to Python's C API for issuing warnings; refer to PEP 230 or to Python's API documentation for the details. ! \begin{seealso} ! \seepep{5}{Guidelines for Language Evolution}{Written by Paul Prescod, ! to specify procedures to be followed when removing old features from ! Python. The policy described in this PEP hasn't been officially ! adopted, but the eventual policy probably won't be too different from ! Prescod's proposal.} ! \seepep{230}{Warning Framework}{Written and implemented by Guido van Rossum.} \end{seealso} ! % ====================================================================== \section{PEP 229: New Build System} --- 276,304 ---- This adds a filter that will apply only to warnings of the class ! \class{DeprecationWarning} triggered in the \module{__main__} module, ! and applies a regular expression to only match the message about the ! \module{regex} module being deprecated, and will cause such warnings ! to be ignored. Warnings can also be printed only once, printed every ! time the offending code is executed, or turned into exceptions that ! will cause the program to stop (unless the exceptions are caught in ! the usual way, of course). Functions were also added to Python's C API for issuing warnings; refer to PEP 230 or to Python's API documentation for the details. ! \begin{seealso} ! \seepep{5}{Guidelines for Language Evolution}{Written ! by Paul Prescod, to specify procedures to be followed when removing ! old features from Python. The policy described in this PEP hasn't ! been officially adopted, but the eventual policy probably won't be too ! different from Prescod's proposal.} ! ! \seepep{230}{Warning Framework}{Written and implemented by Guido van ! Rossum.} ! \end{seealso} ! %====================================================================== \section{PEP 229: New Build System} *************** *** 258,266 **** clearer and simpler. \begin{seealso} ! \seepep{229}{Using Distutils to Build Python}{Written and implemented by A.M. Kuchling.} \end{seealso} ! % ====================================================================== \section{PEP 217: Interactive Display Hook} --- 341,377 ---- clearer and simpler. + \begin{seealso} + + \seepep{229}{Using Distutils to Build Python}{Written + and implemented by A.M. Kuchling.} + + \end{seealso} + + %====================================================================== + \section{Weak References} + + Weak references are a minor but useful new data type in the Python + programmer's toolbox. Storing a reference to an object (say, in a + dictionary or a list) has the side effect of keeping that object alive + forever. There are a few specific cases where this behaviour is + undesirable, object caches being the most common one, and another + being circular references in data structures such as trees. + + For example, a tree might be implemented as a set of \class{Node} + instances where each instances contains a list of its children. If + you need to be able to determine the parent of a given \class{Node}, + an obvious solution would be to have each instance have a reference to + its parent. This creates lots of circular references. + + XXX finish the rest of this section + \begin{seealso} ! ! \seepep{205}{Weak References}{Written and implemented by ! Fred~L. Drake,~Jr.} ! \end{seealso} ! %====================================================================== \section{PEP 217: Interactive Display Hook} *************** *** 275,279 **** ... L = [1,2,3] >>> L.append(L) ! >>> L # Show Python's default output [1, 2, 3, [...]] >>> # Use pprint.pprint() as the display function --- 386,390 ---- ... L = [1,2,3] >>> L.append(L) ! >>> L # Show Python's default output [1, 2, 3, [...]] >>> # Use pprint.pprint() as the display function *************** *** 281,295 **** >>> sys.displayhook = pprint.pprint >>> L ! [1, 2, 3, <Recursion on list with id=135143996>] ! >>> \end{verbatim} \begin{seealso} ! \seepep{217}{Display Hook for Interactive Use}{Written and implemented by Moshe Zadka.} \end{seealso} ! % ====================================================================== \section{PEP 208: New Coercion Model} --- 392,407 ---- >>> sys.displayhook = pprint.pprint >>> L ! [1, 2, 3, <Recursion on list with id=135143996>] ! >>> \end{verbatim} \begin{seealso} ! \seepep{217}{Display Hook for Interactive Use}{Written and implemented ! by Moshe Zadka.} \end{seealso} ! %====================================================================== \section{PEP 208: New Coercion Model} *************** *** 299,318 **** support numeric operations. ! 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 ! that they'll be passed two arguments of the same type; instead they ! may be passed two arguments of differing types, and can then perform ! their own internal coercion. If the slot function is passed a type it ! can't handle, it can indicate the failure by returning a reference to ! the \code{Py_NotImplemented} singleton value. The numeric functions ! 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} --- 411,429 ---- support numeric operations. ! 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 that they'll be passed two arguments of ! the same type; instead they may be passed two arguments of differing ! types, and can then perform their own internal coercion. If the slot ! function is passed a type it can't handle, it can indicate the failure ! by returning a reference to the \code{Py_NotImplemented} singleton ! value. The numeric functions 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} *************** *** 325,329 **** \end{seealso} ! % ====================================================================== \section{Minor Changes and Fixes} --- 436,440 ---- \end{seealso} ! %====================================================================== \section{Minor Changes and Fixes} *************** *** 335,339 **** \begin{itemize} - \item The speed of line-oriented file I/O has been improved because people often complain about its lack of speed, and because it's often --- 446,449 ---- *************** *** 361,378 **** For a fuller discussion of the line I/O changes, see the python-dev ! summary for January 1-15, 2001. ! \item A new method, \method{popitem()}, was added to dictionaries to enable ! destructively iterating through the contents of a dictionary; this can be faster for large dictionaries because . ! \code{D.popitem()} removes a random \code{(\var{key}, \var{value})} pair ! from the dictionary and returns it as a 2-tuple. This was implemented ! mostly by Tim Peters and Guido van Rossum, after a suggestion and ! preliminary patch by Moshe Zadka. ! ! % Not checked into CVS yet -- only proposed ! %\item The \operator{in} operator now works for dictionaries ! %XXX 'if key in dict' now works. ! (Thomas Wouters) ! \item \module{curses.panel}, a wrapper for the panel library, part of --- 471,483 ---- For a fuller discussion of the line I/O changes, see the python-dev ! summary for January 1-15, 2001. ! \item A new method, \method{popitem()}, was added to dictionaries to ! enable destructively iterating through the contents of a dictionary; ! this can be faster for large dictionaries because . ! \code{D.popitem()} removes a random \code{(\var{key}, \var{value})} ! pair from the dictionary and returns it as a 2-tuple. This was ! implemented mostly by Tim Peters and Guido van Rossum, after a ! suggestion and preliminary patch by Moshe Zadka. \item \module{curses.panel}, a wrapper for the panel library, part of *************** *** 384,390 **** \item Modules can now control which names are imported when \code{from ! \var{module} import *} is used, by defining an \code{__all__} attribute ! containing a list of names that will be imported. One common ! complaint is that if the module imports other modules such as \module{sys} or \module{string}, \code{from \var{module} import *} will add them to the importing module's namespace. To fix this, --- 489,495 ---- \item Modules can now control which names are imported when \code{from ! \var{module} import *} is used, by defining an \code{__all__} ! attribute containing a list of names that will be imported. One ! common complaint is that if the module imports other modules such as \module{sys} or \module{string}, \code{from \var{module} import *} will add them to the importing module's namespace. To fix this, *************** *** 397,402 **** A stricter version of this patch was first suggested and implemented ! by Ben Wolfson, but after some python-dev discussion, a weaker ! final version was checked in. \item The PyXML package has gone through a few releases since Python --- 502,507 ---- A stricter version of this patch was first suggested and implemented ! by Ben Wolfson, but after some python-dev discussion, a weaker final ! version was checked in. \item The PyXML package has gone through a few releases since Python *************** *** 408,437 **** \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. - - \item XXX Characters in repr() of strings now use hex escapes, and - use \n,\t,\r for those characters (Ka-Ping Yee) ! \item The \module{ftplib} module now defaults to retrieving files in passive mode, ! because passive mode is more likely to work from behind a firewall. ! This request came from the Debian bug tracking system, since other ! Debian packages use \module{ftplib} to retrieve files and then don't ! work from behind a firewall. It's deemed unlikely that this will ! cause problems for anyone, because Netscape defaults to passive mode ! and few people complain, but if passive mode is unsuitable for your ! application or network setup, call ! \method{set_pasv(0)} on FTP objects to disable passive mode. ! \item The size of the Unicode character database was compressed by another 340K thanks to Fredrik Lundh. \end{itemize} --- 513,555 ---- \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. ! \item Applying \function{repr()} to strings previously used octal ! escapes for non-printable characters; for example, a newline was ! \code{'\e 012'}. This was a vestigial trace of Python's C ancestry, but ! today octal is of very little practical use. Ka-Ping Yee suggested ! using hex escapes instead of octal ones, and using the \code{\e n}, ! \code{\e t}, \code{\e r} escapes for the appropriate characters, and ! implemented this new formatting. ! ! \item The \module{ftplib} module now defaults to retrieving files in ! passive mode, because passive mode is more likely to work from behind ! a firewall. This request came from the Debian bug tracking system, ! since other Debian packages use \module{ftplib} to retrieve files and ! then don't work from behind a firewall. It's deemed unlikely that ! this will cause problems for anyone, because Netscape defaults to ! passive mode and few people complain, but if passive mode is ! unsuitable for your application or network setup, call ! \method{set_pasv(0)} on FTP objects to disable passive mode. ! ! \item Support for raw socket access has been added to the ! \module{socket} module, contributed by Grant Edwards. ! ! \item Syntax errors detected at compile-time can now raise exceptions ! containing the filename and line number of the error, a pleasant side ! effect of the compiler reorganization done by Jeremy Hylton. ! \item The size of the Unicode character database was shrunk by another ! 340K thanks to Fredrik Lundh. \end{itemize} *************** *** 441,481 **** CVS logs for the full details if you want them. - - % ====================================================================== - \section{Nested Scopes} - - % XXX - The PEP for this new feature hasn't been completed yet, and the - requisite changes haven't been checked into CVS yet. - - \begin{seealso} - - \seepep{227}{Statically Nested Scopes}{Written and implemented by Jeremy Hylton.} - - \end{seealso} - - - % ====================================================================== - \section{Weak References} - - % XXX - The PEP for this new feature hasn't been completed yet, and the - requisite changes haven't been checked into CVS yet. - - - \begin{seealso} - - \seepep{205}{Weak References}{Written and implemented by Fred L. Drake, Jr.} - - \end{seealso} - ! % ====================================================================== \section{Acknowledgements} ! The author would like to thank the following people for offering suggestions ! on various drafts of this article: Graeme Cross, ! David Goodger, Jay Graves, Michael Hudson, ! Marc-Andr\'e Lemburg, Fredrik Lundh, Neil Schemenauer, Thomas Wouters. \end{document} --- 559,570 ---- CVS logs for the full details if you want them. ! %====================================================================== \section{Acknowledgements} ! The author would like to thank the following people for offering ! suggestions on various drafts of this article: Graeme Cross, David ! Goodger, Jay Graves, Michael Hudson, Marc-Andr\'e Lemburg, Fredrik ! Lundh, Neil Schemenauer, Thomas Wouters. \end{document} |
From: A.M. K. <aku...@us...> - 2001-01-29 17:37:01
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv30333 Modified Files: python-21.tex Log Message: Add note about non-recursive Makefiles Get Fred's name right Add some XXX items that need to be written Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** python-21.tex 2001/01/24 01:11:26 1.8 --- python-21.tex 2001/01/29 17:36:53 1.9 *************** *** 251,254 **** --- 251,261 ---- instead of the default, or it may even be backed out completely. + In another far-reaching change to the build mechanism, Neil + Schemenauer restructured things so Python now uses a single makefile + that isn't recursive, instead of makefiles in the top directory and in + each of the Python/, Parser/, Objects/, and Modules/ subdirectories. + This makes building Python faster, and also makes the build process + clearer and simpler. + \begin{seealso} \seepep{229}{Using Distutils to Build Python}{Written and implemented by A.M. Kuchling.} *************** *** 362,365 **** --- 369,378 ---- mostly by Tim Peters and Guido van Rossum, after a suggestion and preliminary patch by Moshe Zadka. + + % Not checked into CVS yet -- only proposed + %\item The \operator{in} operator now works for dictionaries + %XXX 'if key in dict' now works. + (Thomas Wouters) + \item \module{curses.panel}, a wrapper for the panel library, part of *************** *** 407,410 **** --- 420,426 ---- This change was proposed and implemented by Thomas Wouters. + \item XXX Characters in repr() of strings now use hex escapes, and + use \n,\t,\r for those characters (Ka-Ping Yee) + \item The \module{ftplib} module now defaults to retrieving files in passive mode, because passive mode is more likely to work from behind a firewall. *************** *** 450,454 **** \begin{seealso} ! \seepep{205}{Weak References}{Written and implemented by Fred L. Drake.} \end{seealso} --- 466,470 ---- \begin{seealso} ! \seepep{205}{Weak References}{Written and implemented by Fred L. Drake, Jr.} \end{seealso} |
From: A.M. K. <aku...@us...> - 2001-01-24 01:11:09
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv11559 Modified Files: python-21.tex Log Message: Add names of people who've pointed out broken links and images Bump version number Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** python-21.tex 2001/01/24 00:52:56 1.7 --- python-21.tex 2001/01/24 01:11:26 1.8 *************** *** 4,8 **** \title{What's New in Python 2.1} ! \release{0.03} \author{A.M. Kuchling} \authoraddress{\email{am...@bi...}} --- 4,8 ---- \title{What's New in Python 2.1} ! \release{0.04} \author{A.M. Kuchling} \authoraddress{\email{am...@bi...}} *************** *** 459,463 **** The author would like to thank the following people for offering suggestions ! on various drafts of this article: David Goodger, Michael Hudson, Marc-Andr\'e Lemburg, Fredrik Lundh, Neil Schemenauer, Thomas Wouters. --- 459,464 ---- The author would like to thank the following people for offering suggestions ! on various drafts of this article: Graeme Cross, ! David Goodger, Jay Graves, Michael Hudson, Marc-Andr\'e Lemburg, Fredrik Lundh, Neil Schemenauer, Thomas Wouters. |
From: A.M. K. <aku...@us...> - 2001-01-24 00:52:39
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv8161 Modified Files: python-21.tex Log Message: Fredrik pointed out that the database shrank more than 55K Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** python-21.tex 2001/01/23 15:21:05 1.6 --- python-21.tex 2001/01/24 00:52:56 1.7 *************** *** 417,421 **** \method{set_pasv(0)} on FTP objects to disable passive mode. ! \item The size of the Unicode character database was compressed by another 55K thanks to Fredrik Lundh. \end{itemize} --- 417,421 ---- \method{set_pasv(0)} on FTP objects to disable passive mode. ! \item The size of the Unicode character database was compressed by another 340K thanks to Fredrik Lundh. \end{itemize} *************** *** 458,464 **** \section{Acknowledgements} ! The author would like to thank the following people for offering ! suggestions on various drafts of this article: David Goodger, Michael ! Hudson, Marc-Andr\'e Lemburg, Neil Schemenauer, Thomas Wouters. \end{document} --- 458,464 ---- \section{Acknowledgements} ! The author would like to thank the following people for offering suggestions ! on various drafts of this article: David Goodger, Michael Hudson, ! Marc-Andr\'e Lemburg, Fredrik Lundh, Neil Schemenauer, Thomas Wouters. \end{document} |
From: A.M. K. <aku...@us...> - 2001-01-23 15:20:49
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv27171 Modified Files: python-21.tex Log Message: Jeremy didn't write PEP 205, Fred did! Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** python-21.tex 2001/01/23 02:48:26 1.5 --- python-21.tex 2001/01/23 15:21:05 1.6 *************** *** 450,454 **** \begin{seealso} ! \seepep{205}{Statically Nested Scopes}{Written and implemented by Jeremy Hylton.} \end{seealso} --- 450,454 ---- \begin{seealso} ! \seepep{205}{Weak References}{Written and implemented by Fred L. Drake.} \end{seealso} |