[Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.42,1.43

akuchling@users.sourceforge.net akuchling@users.sourceforge.net
Mon, 05 Aug 2002 18:40:50 -0700


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

Modified Files:
	whatsnew23.tex 
Log Message:
Mention list.sort()
Document heapq module
Add PEP263 section (not sure I really understand the PEP's effect on 8-bit
   strings, though -- will have to experiment with it)


Index: whatsnew23.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** whatsnew23.tex	4 Aug 2002 01:20:05 -0000	1.42
--- whatsnew23.tex	6 Aug 2002 01:40:48 -0000	1.43
***************
*** 2,8 ****
  % $Id$
  
- % TODO:
- %   Go through and get the contributor's name for all the various changes
- 
  \title{What's New in Python 2.3}
  \release{0.03}
--- 2,5 ----
***************
*** 16,25 ****
  % Optik (or whatever it gets called)
  %
- % Bug #580462: changes to GC API
- %
- % heapq module
- %
  % MacOS framework-related changes (section of its own, probably)
  %
  
  %\section{Introduction \label{intro}}
--- 13,19 ----
  % Optik (or whatever it gets called)
  %
  % MacOS framework-related changes (section of its own, probably)
  %
+ % New sorting code
  
  %\section{Introduction \label{intro}}
***************
*** 192,195 ****
--- 186,220 ----
  
  %======================================================================
+ \section{PEP 263: \label{section-encodings}}
+ 
+ Python source files can now be declared as being in different
+ character set encodings.  Encodings are declared by including a
+ specially formatted comment in the first or second line of the source
+ file.  For example, a UTF-8 file can be declared with:
+ 
+ \begin{verbatim}
+ #!/usr/bin/env python
+ # -*- coding: UTF-8 -*-
+ \end{verbatim}
+ 
+ Without such an encoding declaration, the default encoding used is
+ ISO-8859-1, also known as Latin1.  
+ 
+ The encoding declaration only affects Unicode string literals; the
+ text in the source code will be converted to Unicode using the
+ specified encoding.  Note that Python identifiers are still restricted
+ to ASCII characters, so you can't have variable names that use
+ characters outside of the usual alphanumerics.
+ 
+ \begin{seealso}
+ 
+ \seepep{263}{Defining Python Source Code Encodings}{Written by
+ Marc-Andr\'e Lemburg and Martin von L\"owis; implemented by Martin von
+ L\"owis.}
+ 
+ \end{seealso}
+ 
+ 
+ %======================================================================
  \section{PEP 278: Universal Newline Support}
  
***************
*** 559,562 ****
--- 584,591 ----
     can't create \class{basestring} instances.
  
+ \item The \method{sort()} method of list objects has been extensively
+ rewritten by Tim Peters, and the implementation is significantly
+ faster.
+ 
  \item Most type objects are now callable, so you can use them
  to create new objects such as functions, classes, and modules.  (This
***************
*** 676,679 ****
--- 705,754 ----
  \end{verbatim}
  
+ \item The new \module{heapq} module contains an implementation of a
+ heap queue algorithm.  A heap is an array-like data structure that
+ keeps items in a sorted order such that, for every index k, heap[k] <=
+ heap[2*k+1] and heap[k] <= heap[2*k+2].  This makes it quick to remove
+ the smallest item, and inserting a new item while maintaining the heap
+ property is O(lg~n).  (See
+ \url{http://www.nist.gov/dads/HTML/priorityque.html} for more
+ information about the priority queue data structure.)
+ 
+ The Python \module{heapq} module provides \function{heappush()} and
+ \function{heappop()} functions for adding and removing items while
+ maintaining the heap property on top of some other mutable Python
+ sequence type.  For example:
+ 
+ \begin{verbatim}
+ >>> import heapq
+ >>> heap = []
+ >>> for item in [3, 7, 5, 11, 1]:
+ ...    heapq.heappush(heap, item)
+ ...
+ >>> heap
+ [1, 3, 5, 11, 7]
+ >>> heapq.heappop(heap)
+ 1
+ >>> heapq.heappop(heap)
+ 3
+ >>> heap
+ [5, 7, 11]
+ >>>
+ >>> heapq.heappush(heap, 5)
+ >>> heap = []
+ >>> for item in [3, 7, 5, 11, 1]:
+ ...    heapq.heappush(heap, item)
+ ...
+ >>> heap
+ [1, 3, 5, 11, 7]
+ >>> heapq.heappop(heap)
+ 1
+ >>> heapq.heappop(heap)
+ 3
+ >>> heap
+ [5, 7, 11]
+ >>>
+ \end{verbatim}
+ 
+ (Contributed by Kevin O'Connor.)
  
  \item Two new functions in the \module{math} module, 
***************
*** 980,983 ****
--- 1055,1064 ----
  
  %======================================================================
+ \section{Porting to Python 2.3}
+ 
+ XXX write this
+ 
+ 
+ %======================================================================
  \section{Acknowledgements \label{acks}}
  
***************
*** 986,990 ****
  article: Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr.,
  Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre,
! Gustavo Niemeyer, Neal Norwitz.
  
  \end{document}
--- 1067,1071 ----
  article: Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr.,
  Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre,
! Gustavo Niemeyer, Neal Norwitz, Jason Tishler.
  
  \end{document}