[Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.32,1.33

akuchling@users.sourceforge.net akuchling@users.sourceforge.net
Thu, 11 Jul 2002 13:09:53 -0700


Update of /cvsroot/python/python/dist/src/Doc/whatsnew
In directory usw-pr-cvs1:/tmp/cvs-serv3048

Modified Files:
	whatsnew23.tex 
Log Message:
Add some items
Expand the "Other Language Changes" section
Rewrite various passages.  


Index: whatsnew23.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** whatsnew23.tex	11 Jul 2002 19:27:46 -0000	1.32
--- whatsnew23.tex	11 Jul 2002 20:09:50 -0000	1.33
***************
*** 23,30 ****
  % Optik (or whatever it gets called)
  %
- % getopt.gnu_getopt
- %
- % Docstrings now optional (with --without-doc-strings)
- %
  % New dependency argument to distutils.Extension
  %
--- 23,26 ----
***************
*** 234,238 ****
  
  %======================================================================
! \section{PEP 279: The \function{enumerate()} Built-in Function}
  
  A new built-in function, \function{enumerate()}, will make
--- 230,234 ----
  
  %======================================================================
! \section{PEP 279: The \function{enumerate()} Built-in Function\label{section-enumerate}}
  
  A new built-in function, \function{enumerate()}, will make
***************
*** 341,353 ****
  \end{seealso}
  
- \section{Extended Slices\label{extended-slices}}
  
! Ever since Python 1.4 the slice syntax has supported a third
! ``stride'' argument, but the built-in sequence types have not
! supported this feature (it was initially included at the behest of the
! developers of the Numerical Python package).  Starting with Python
! 2.3, the built-in sequence types do support the stride.
  
! For example, to extract the elements of a list with even indexes:
  
  \begin{verbatim}
--- 337,355 ----
  \end{seealso}
  
  
! \section{Extended Slices\label{section-slices}}
  
! Ever since Python 1.4, the slicing syntax has supported an optional
! third ``step'' or ``stride'' argument.  For example, these are all
! legal Python syntax: \code{L[1:10:2]}, \code{L[:-1:1]},
! \code{L[::-1]}.  This was added to Python included at the request of
! the developers of Numerical Python.  However, the built-in sequence
! types of lists, tuples, and strings have never supported this feature,
! and you got a \exception{TypeError} if you tried it.  Michael Hudson
! contributed a patch that was applied to Python 2.3 and fixed this 
! shortcoming.
! 
! For example, you can now easily extract the elements of a list that
! have even indexes:
  
  \begin{verbatim}
***************
*** 357,361 ****
  \end{verbatim}
  
! To make a copy of the same list in reverse order:
  
  \begin{verbatim}
--- 359,364 ----
  \end{verbatim}
  
! Negative values also work, so you can make a copy of the same list in
! reverse order:
  
  \begin{verbatim}
***************
*** 364,392 ****
  \end{verbatim}
  
  %======================================================================
  \section{Other Language Changes}
  
! %Here are the changes that Python 2.3 makes to the core language.
  
! %\begin{itemize}
! %\item The \keyword{yield} statement is now always a keyword, as
! %described in section~\ref{section-generators}.
  
! %\item Two new constants, \constant{True} and \constant{False} were
! %added along with the built-in \class{bool} type, as described in
! %section~\ref{section-bool}.
  
! %\item 
! %\end{itemize}
  
  
! %\begin{PendingDeprecationWarning}
  A new warning, \exception{PendingDeprecationWarning} was added to
  provide direction on features which are in the process of being
! deprecated.  The warning will not be printed by default.  To see the
! pending deprecations, use
! \programopt{-Walways::PendingDeprecationWarning::} on the command line
! or use \function{warnings.filterwarnings()}.
! %\end{PendingDeprecationWarning}
  
  
--- 367,493 ----
  \end{verbatim}
  
+ This also works for strings:
+ 
+ \begin{verbatim}
+ >>> s='abcd'
+ >>> s[::2]
+ 'ac'
+ >>> s[::-1]
+ 'dcba'
+ \end{verbatim}
+ 
+ 
+ 
  %======================================================================
  \section{Other Language Changes}
  
! Here are all of the changes that Python 2.3 makes to the core Python
! language.
  
! \begin{itemize}
! \item The \keyword{yield} statement is now always a keyword, as
! described in section~\ref{section-generators} of this document.
  
! \item A new built-in function \function{enumerate()} 
! was added, as described in section~\ref{section-enumerate} of this
! document.
  
! \item Two new constants, \constant{True} and \constant{False} were
! added along with the built-in \class{bool} type, as described in
! section~\ref{section-bool} of this document.
  
+ \item Built-in types now support the extended slicing syntax, 
+ as described in section~\ref{section-slices} of this document.
  
! \item Dictionaries have a new method, \method{pop(\var{key})}, that
! returns the value corresponding to \var{key} and removes that
! key/value pair from the dictionary.  \method{pop()} will raise a
! \exception{KeyError} if the requested key isn't present in the
! dictionary:
! 
! \begin{verbatim}
! >>> d = {1:2}
! >>> d
! {1: 2}
! >>> d.pop(4)
! Traceback (most recent call last):
!   File ``stdin'', line 1, in ?
! KeyError: 4
! >>> d.pop(1)
! 2
! >>> d.pop(1)
! Traceback (most recent call last):
!   File ``stdin'', line 1, in ?
! KeyError: pop(): dictionary is empty
! >>> d
! {}
! >>>
! \end{verbatim}
! 
! (Patch contributed by Raymond Hettinger.)
! 
! \item The \method{strip()}, \method{lstrip()}, and \method{rstrip()}
! string methods now have an optional argument for specifying the
! characters to strip.  The default is still to remove all whitespace
! characters:
! 
! \begin{verbatim}
! >>> '   abc '.strip()
! 'abc'
! >>> '><><abc<><><>'.strip('<>')
! 'abc'
! >>> '><><abc<><><>\n'.strip('<>')
! 'abc<><><>\n'
! >>> u'\u4000\u4001abc\u4000'.strip(u'\u4000')
! u'\u4001abc'
! >>>
! \end{verbatim}
! 
! \item The \method{startswith()} and \method{endswith()}
! string methods now accept negative numbers for the start and end
! parameters.
! 
! \item Another new string method is \method{zfill()}, originally a
! function in the \module{string} module.  \method{zfill()} pads a
! numeric string with zeros on the left until it's the specified width.
! Note that the \code{\%} operator is still more flexible and powerful
! than \method{zfill()}.
! 
! \begin{verbatim}
! >>> '45'.zfill(4)
! '0045'
! >>> '12345'.zfill(4)
! '12345'
! >>> 'goofy'.zfill(6)
! '0goofy'
! \end{verbatim}
! 
! \item 
  A new warning, \exception{PendingDeprecationWarning} was added to
  provide direction on features which are in the process of being
! deprecated.  The warning will \emph{not} be printed by default.  To
! check for use of features that will be deprecated in the future,
! supply \programopt{-Walways::PendingDeprecationWarning::} on the
! command line or use \function{warnings.filterwarnings()}.
! 
! \item One minor but far-reaching change is that the names of extension
! types defined by the modules included with Python now contain the
! module and a \samp{.} in front of the type name.  For example, in
! Python 2.2, if you created a socket and printed its
! \member{__class__}, you'd get this output:
! 
! \begin{verbatim}
! >>> s = socket.socket()
! >>> s.__class__
! <type 'socket'>
! \end{verbatim}
! 
! In 2.3, you get this:
! \begin{verbatim}
! >>> s.__class__
! <type '_socket.socket'>
! \end{verbatim}
! 
! \end{itemize}
  
  
***************
*** 458,464 ****
  distributed with the source to Python 2.3 that allows Python
  extensions to use the 2.3 interfaces to memory allocation and compile
! against any version of Python since 1.5.2.  (The idea is that you take
! the file from Python's source distribution and bundle it with the
! source of your extension).
  
  \begin{seealso}
--- 559,565 ----
  distributed with the source to Python 2.3 that allows Python
  extensions to use the 2.3 interfaces to memory allocation and compile
! against any version of Python since 1.5.2.  You would copy the file
! from Python's source distribution and bundle it with the source of
! your extension.
  
  \begin{seealso}
***************
*** 472,475 ****
--- 573,577 ----
  \end{seealso}
  
+ 
  %======================================================================
  \section{New and Improved Modules}
***************
*** 516,600 ****
  (Contributed by Greg Ward.)
  
- \item One minor but far-reaching change is that the names of extension
- types defined by the modules included with Python now contain the
- module and a \samp{.} in front of the type name.  For example, in
- Python 2.2, if you created a socket and printed its
- \member{__class__}, you'd get this output:
- 
- \begin{verbatim}
- >>> s = socket.socket()
- >>> s.__class__
- <type 'socket'>
- \end{verbatim}
- 
- In 2.3, you get this:
- \begin{verbatim}
- >>> s.__class__
- <type '_socket.socket'>
- \end{verbatim}
- 
- \item The \method{strip()}, \method{lstrip()}, and \method{rstrip()}
- string methods now have an optional argument for specifying the
- characters to strip.  The default is still to remove all whitespace
- characters:
- 
- \begin{verbatim}
- >>> '   abc '.strip()
- 'abc'
- >>> '><><abc<><><>'.strip('<>')
- 'abc'
- >>> '><><abc<><><>\n'.strip('<>')
- 'abc<><><>\n'
- >>> u'\u4000\u4001abc\u4000'.strip(u'\u4000')
- u'\u4001abc'
- >>>
- \end{verbatim}
- 
- \item The \method{startswith()} and \method{endswith()}
- string methods now have accept negative numbers for
- start and end parameters.
- 
- \item Another new string method is \method{zfill()}, originally a
- function in the \module{string} module.  \method{zfill()} pads a
- numeric string with zeros on the left until it's the specified width.
- Note that the \code{\%} operator is still more flexible and powerful
- than \method{zfill()}.
- 
- \begin{verbatim}
- >>> '45'.zfill(4)
- '0045'
- >>> '12345'.zfill(4)
- '12345'
- >>> 'goofy'.zfill(6)
- '0goofy'
- \end{verbatim}
- 
- \item Dictionaries have a new method, \method{pop(\var{key})}, that
- returns the value corresponding to \var{key} and removes that
- key/value pair from the dictionary.  \method{pop()} will raise a
- \exception{KeyError} if the requsted key isn't present in the
- dictionary:
- 
- \begin{verbatim}
- >>> d = {1:2}
- >>> d
- {1: 2}
- >>> d.pop(4)
- Traceback (most recent call last):
-   File ``stdin'', line 1, in ?
- KeyError: 4
- >>> d.pop(1)
- 2
- >>> d.pop(1)
- Traceback (most recent call last):
-   File ``stdin'', line 1, in ?
- KeyError: pop(): dictionary is empty
- >>> d
- {}
- >>>
- \end{verbatim}
- 
- (Contributed by Raymond Hettinger.)
- 
  \item Two new functions in the \module{math} module, 
  \function{degrees(\var{rads})} and \function{radians(\var{degs})},
--- 618,621 ----
***************
*** 606,610 ****
  \item Three new functions, \function{getpgid()}, \function{killpg()},
  and \function{mknod()}, were added to the \module{posix} module that
! underlies the \module{os} module.
  
  \item Two new binary packagers were added to the Distutils.
--- 627,649 ----
  \item Three new functions, \function{getpgid()}, \function{killpg()},
  and \function{mknod()}, were added to the \module{posix} module that
! underlies the \module{os} module.  (Contributed by Gustavo Niemeyer
! and Geert Jansen.)
! 
! \item The \module{getopt} module gained a new function,
! \function{gnu_getopt()}, that supports the same arguments as the existing
! \function{getopt()} function but uses GNU-style scanning mode. 
! The existing \function{getopt()} stops processing options as soon as a
! non-option argument is encountered, but in GNU-style mode processing
! continues, meaning that options and arguments can be mixed.  For
! example:
! 
! \begin{verbatim}
! >>> getopt.getopt(['-f', 'filename', 'output', '-v'], 'f:v')
! ([('-f', 'filename')], ['output', '-v'])
! >>> getopt.gnu_getopt(['-f', 'filename', 'output', '-v'], 'f:v')
! ([('-f', 'filename'), ('-v', '')], ['output'])
! \end{verbatim}
! 
! (Contributed by Peter \AA{strand}.)
  
  \item Two new binary packagers were added to the Distutils.
***************
*** 652,655 ****
--- 691,701 ----
  when running Python's \file{configure} script.  (Contributed by Ondrej
  Palkovsky.)
+ 
+ \item The interpreter can be compiled without any docstrings for 
+ the built-in functions and modules by supplying
+ \longprogramopt{--without-doc-strings} to the \file{configure} script.
+ This makes the Python executable about 10\% smaller, but will also
+ mean that you can't get help for Python's built-ins.  (Contributed by
+ Gustavo Niemeyer.)
  
  \item The \cfunction{PyArg_NoArgs()} macro is now deprecated, and code