[Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.91,1.92
akuchling@users.sourceforge.net
akuchling@users.sourceforge.net
Mon, 30 Dec 2002 17:20:32 -0800
Update of /cvsroot/python/python/dist/src/Doc/whatsnew
In directory sc8-pr-cvs1:/tmp/cvs-serv14243
Modified Files:
whatsnew23.tex
Log Message:
Add lots of items.
The only thing missing now is the new date/time stuff.
Index: whatsnew23.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -d -r1.91 -r1.92
*** whatsnew23.tex 24 Dec 2002 14:51:43 -0000 1.91
--- whatsnew23.tex 31 Dec 2002 01:20:30 -0000 1.92
***************
*** 13,23 ****
% MacOS framework-related changes (section of its own, probably)
- % the new set-next-statement functionality of pdb (SF #643835)
-
%\section{Introduction \label{intro}}
! {\large This article is a draft, and is currently up to date for some
! random version of the CVS tree from early November 2002. Please send any
! additions, comments or errata to the author.}
This article explains the new features in Python 2.3. The tentative
--- 13,21 ----
% MacOS framework-related changes (section of its own, probably)
%\section{Introduction \label{intro}}
! {\large This article is a draft, and is currently up to date for
! Python 2.3alpha1. Please send any additions, comments or errata to
! the author.}
This article explains the new features in Python 2.3. The tentative
***************
*** 648,651 ****
--- 646,771 ----
%======================================================================
+ \section{PEP 273: Importing Modules from Zip Archives}
+
+ The new \module{zipimport} module adds support for importing
+ modules from a ZIP-format archive. You shouldn't need to import the
+ module explicitly; it will be automatically imported if a ZIP
+ archive's filename is added to \code{sys.path}. For example:
+
+ \begin{verbatim}
+ amk@nyman:~/src/python$ unzip -l /tmp/example.zip
+ Archive: /tmp/example.zip
+ Length Date Time Name
+ -------- ---- ---- ----
+ 8467 11-26-02 22:30 jwzthreading.py
+ -------- -------
+ 8467 1 file
+ amk@nyman:~/src/python$ ./python
+ Python 2.3a0 (#1, Dec 30 2002, 19:54:32)
+ [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2
+ Type "help", "copyright", "credits" or "license" for more information.
+ >>> import sys
+ >>> sys.path.insert(0, '/tmp/example.zip') # Add .zip file to front of path
+ >>> import jwzthreading
+ >>> jwzthreading.__file__
+ '/tmp/example.zip/jwzthreading.py'
+ >>>
+ \end{verbatim}
+
+ An entry in \code{sys.path} can now be the filename of a ZIP archive.
+ The ZIP archive can contain any kind of files, but only files named
+ \code{*.py}, \code{*.pyc}, or \code{*.pyo} can be imported. If an
+ archive only contains \code{*.py} files, Python will not attempt to
+ modify the archive by adding the corresponding {*.pyc} file.
+ Therefore, if a ZIP archive doesn't contain {*.pyc} files, importing
+ may be rather slow.
+
+ A path within the archive can also be specified to only import from a
+ subdirectory; for example, the path \file{/tmp/example.zip/lib/}
+ would only import from the \file{lib/} subdirectory within the
+ archive.
+
+ This new feature is implemented using the new import hooks from
+ \pep{302}; see section~\ref{section-pep302} for a description.
+
+ \begin{seealso}
+
+ \seepep{273}{Import Modules from Zip Archives}{Written by James C. Ahlstrom,
+ who also provided an implementation.
+ Python 2.3 follows the specification in \pep{273},
+ but uses an implementation written by Just van Rossum
+ that uses the import hooks described in \pep{302}.}
+
+ \end{seealso}
+
+ %======================================================================
+ \section{PEP 302: New Import Hooks \label{section-pep302}}
+
+ While it's been possible to write custom import hooks ever since the
+ \module{ihooks} module was introduced in Python 1.3, no one has ever
+ been really happy with it, because writing new import hooks is
+ difficult and messy. There have been various alternative interfaces
+ proposed, such as the \module{imputil} and \module{iu} modules, but
+ none has ever gained much acceptance, and none was easily usable from
+ \C{} code.
+
+ \pep{302} borrows ideas from its predecessors, especially from
+ Gordon McMillan's \module{iu} module. Three new items
+ are added to the \module{sys} module:
+
+ \begin{itemize}
+ \item[\code{sys.path_hooks}] is a list of functions. Each function
+ takes a string containing a path and returns either \code{None} or an
+ importer object that will handle imports from this path.
+
+ \item[\code{sys.path_importer_cache}] caches importer objects for
+ each path, so \code{sys.path_hooks} will only need to be traversed
+ once for each path.
+
+ \item[\code{sys.meta_path}] is a list of importer objects
+ that will be traversed before \code{sys.path} is checked at all.
+ This list is initially empty, but can be extended. Additional built-in
+ and frozen modules can be imported by an object added to this list.
+
+ \end{itemize}
+
+ Importer objects must have a single method,
+ \method{find_module(\var{fullname}, \var{path}=None)}. \var{fullname}
+ will be a module or package name, e.g. \samp{string} or
+ \samp{spam.ham}. \method{find_module()} must return a loader object
+ that has a single method, \method{load_module(\var{fullname})}, that
+ creates and returns the corresponding module object.
+
+ Pseudo-code for Python's new import logic, therefore, looks something
+ like this (simplified a bit; see \pep{302} for the full details):
+
+ \begin{verbatim}
+ for mp in sys.meta_path:
+ loader = mp(fullname)
+ if loader is not None:
+ <module> = loader(fullname)
+
+ for path in sys.path:
+ for hook in sys.path_hooks:
+ importer = hook(path)
+ if importer is not None:
+ loader = importer.find_module(fullname)
+ return loader.load_module(fullname)
+
+ # Not found!
+ raise ImportError
+ \end{verbatim}
+
+ \begin{seealso}
+
+ \seepep{302}{New Import Hooks}{Written by Just van~Rossum and Paul Moore.
+ Implemented by Just van Rossum.
+ % XXX is that credit right?
+ }
+
+ \end{seealso}
+
+
+ %======================================================================
\section{Extended Slices\label{section-slices}}
***************
*** 798,802 ****
or floating-point number is too large to fit into an integer. This
can lead to the paradoxical result that
! \code{isinstance(int(\var{expression}), int)} is false, but that seems unlikely to cause problems in practice.
\item Built-in types now support the extended slicing syntax,
--- 918,923 ----
or floating-point number is too large to fit into an integer. This
can lead to the paradoxical result that
! \code{isinstance(int(\var{expression}), int)} is false, but that seems
! unlikely to cause problems in practice.
\item Built-in types now support the extended slicing syntax,
***************
*** 836,840 ****
(Patches contributed by Raymond Hettinger.)
! The \function{dict()} constructor now also accepts keyword arguments to
simplify creating small dictionaries:
--- 957,961 ----
(Patches contributed by Raymond Hettinger.)
! Also, the \function{dict()} constructor now accepts keyword arguments to
simplify creating small dictionaries:
***************
*** 1013,1016 ****
--- 1134,1140 ----
\begin{itemize}
+ \item The creation of new-style class instances has been made much
+ faster; they're now faster than classic classes!
+
\item The \method{sort()} method of list objects has been extensively
rewritten by Tim Peters, and the implementation is significantly
***************
*** 1057,1061 ****
(Contributed by Jason Orendorff.)
! \item The \module{bsddb} module has been updated to version 3.4.0
of the \ulink{PyBSDDB}{http://pybsddb.sourceforge.net} package,
providing a more complete interface to the transactional features of
--- 1181,1185 ----
(Contributed by Jason Orendorff.)
! \item The \module{bsddb} module has been updated to version 4.1.1
of the \ulink{PyBSDDB}{http://pybsddb.sourceforge.net} package,
providing a more complete interface to the transactional features of
***************
*** 1119,1122 ****
--- 1243,1248 ----
\end{verbatim}
+ \item The \module{gzip} module can now handle files exceeding 2~Gb.
+
\item The new \module{heapq} module contains an implementation of a
heap queue algorithm. A heap is an array-like data structure that
***************
*** 1219,1224 ****
[3407, 3805, 1505, 7023, 2401, 2267, 9733, 3151, 8083, 9195]
\end{verbatim}
!
! (Contributed by Raymond Hettinger.)
\item The \module{readline} module also gained a number of new
--- 1345,1354 ----
[3407, 3805, 1505, 7023, 2401, 2267, 9733, 3151, 8083, 9195]
\end{verbatim}
!
! The \module{random} module now uses a new algorithm, the Mersenne
! Twister, implemented in C. It's faster and more extensively studied
! than the previous algorithm.
!
! (All changes contributed by Raymond Hettinger.)
\item The \module{readline} module also gained a number of new
***************
*** 1226,1229 ****
--- 1356,1363 ----
\function{get_current_history_length()}, and \function{redisplay()}.
+ \item The \module{shutil} module gained a \function{move(\var{src},
+ \var{dest})} that recursively moves a file or directory to a new
+ location.
+
\item Support for more advanced POSIX signal handling was added
to the \module{signal} module by adding the \function{sigpending},
***************
*** 1285,1288 ****
--- 1419,1444 ----
(Contributed by Greg Ward.)
+ \item The \module{thread} and \module{threading} modules now have
+ companion, \module{dummy_thread} and \module{dummy_threading}, that
+ provide a do-nothing implementation of the \module{thread} module's
+ interface, even if threads are not supported. The intention is to
+ simplify thread-aware modules (that \emph{don't} rely on threads to
+ run) by putting the following code at the top:
+
+ % XXX why as _threading?
+ \begin{verbatim}
+ try:
+ import threading as _threading
+ except ImportError:
+ import dummy_threading as _threading
+ \end{verbatim}
+
+ Code can then call functions and use classes in \module{_threading}
+ whether or not threads are supported, avoiding an \keyword{if}
+ statement and making the code slightly clearer. This module will not
+ magically make multithreaded code run without threads; code that waits
+ for another thread to return or to do something will simply hang
+ forever.
+
\item The \module{time} module's \function{strptime()} function has
long been an annoyance because it uses the platform C library's
***************
*** 1611,1614 ****
--- 1767,1772 ----
\end{itemize}
+ It's also no longer possible to build Python without the garbage collector.
+
\item Python can now optionally be built as a shared library
(\file{libpython2.3.so}) by supplying \longprogramopt{enable-shared}
***************
*** 1673,1676 ****
--- 1831,1850 ----
+ \begin{comment}
+ %======================================================================
+ \subsection{Date/Time Type}
+
+ Date and time types suitable for expressing timestamps were added as
+ the \module{datetime} module. The types don't support different
+ calendars or many fancy features, and just stick to the basics.
+
+ The three primary types are: \class{date}, representing a day, month,
+ and year; \class{time}, consisting of hour, minute, and second value;
+ and \class{datetime}, which contains both a date and a time.
+
+ XXX finish this section
+ \end{comment}
+
+
%======================================================================
\subsection{Port-Specific Changes}
***************
*** 1696,1700 ****
Sean Reifschneider.)
! Python now supports AtheOS (\url{http://www.atheos.cx}) and GNU/Hurd.
--- 1870,1875 ----
Sean Reifschneider.)
! Python now supports AtheOS (\url{http://www.atheos.cx}), GNU/Hurd,
! OpenVMS, and OS/2 with EMX.
***************
*** 1738,1741 ****
--- 1913,1922 ----
This will have the added effect of making the code work as desired
under ``python -O'' in earlier versions of Python.
+
+ A nifty new feature is that trace functions can now the
+ \member{f_lineno} attribute of frame objects can now be assigned to,
+ changing the line that will be executed next. A \samp{jump} command
+ has been added to the \module{pdb} debugger taking advantage of this
+ new feature. (Implemented by Richie Hindle.)
\end{itemize}