[Commits] python.it commit r164 - in
python/python/Doc/branches/2.3.4: . commontex lib mac ref tut
whatsnew
commit a svn.python.it
commit a svn.python.it
Dom 28 Maggio 2006 00:23:17 CEST
Author: manlio
Date: Sun May 28 00:23:12 2006
New Revision: 164
Modified:
python/python/Doc/branches/2.3.4/Makefile.deps
python/python/Doc/branches/2.3.4/README
python/python/Doc/branches/2.3.4/commontex/license.tex
python/python/Doc/branches/2.3.4/lib/libbinascii.tex
python/python/Doc/branches/2.3.4/lib/libcd.tex
python/python/Doc/branches/2.3.4/lib/libcurses.tex
python/python/Doc/branches/2.3.4/lib/libdifflib.tex
python/python/Doc/branches/2.3.4/lib/libfuncs.tex
python/python/Doc/branches/2.3.4/lib/libhttplib.tex
python/python/Doc/branches/2.3.4/lib/libinspect.tex
python/python/Doc/branches/2.3.4/lib/liboperator.tex
python/python/Doc/branches/2.3.4/lib/liboptparse.tex
python/python/Doc/branches/2.3.4/lib/libpickle.tex
python/python/Doc/branches/2.3.4/lib/libsite.tex
python/python/Doc/branches/2.3.4/lib/libstdtypes.tex
python/python/Doc/branches/2.3.4/lib/libsys.tex
python/python/Doc/branches/2.3.4/lib/libtarfile.tex
python/python/Doc/branches/2.3.4/lib/libunittest.tex
python/python/Doc/branches/2.3.4/lib/xmldomminidom.tex
python/python/Doc/branches/2.3.4/mac/libmac.tex
python/python/Doc/branches/2.3.4/mac/using.tex
python/python/Doc/branches/2.3.4/ref/ref1.tex
python/python/Doc/branches/2.3.4/ref/ref2.tex
python/python/Doc/branches/2.3.4/ref/ref3.tex
python/python/Doc/branches/2.3.4/ref/ref5.tex
python/python/Doc/branches/2.3.4/ref/ref6.tex
python/python/Doc/branches/2.3.4/tut/glossary.tex
python/python/Doc/branches/2.3.4/whatsnew/whatsnew24.tex
Log:
corretti files nel branch per far corrispondere numero di blocchi con originale
Modified: python/python/Doc/branches/2.3.4/Makefile.deps
==============================================================================
--- python/python/Doc/branches/2.3.4/Makefile.deps (original)
+++ python/python/Doc/branches/2.3.4/Makefile.deps Sun May 28 00:23:12 2006
@@ -284,7 +284,7 @@
lib/libcalendar.tex \
lib/libpopen2.tex \
lib/libbisect.tex \
- lib/libcollections.tex \
+ lib/libcollections.tex \
lib/libheapq.tex \
lib/libmimetypes.tex \
lib/libsmtplib.tex \
Modified: python/python/Doc/branches/2.3.4/README
==============================================================================
--- python/python/Doc/branches/2.3.4/README (original)
+++ python/python/Doc/branches/2.3.4/README Sun May 28 00:23:12 2006
@@ -51,7 +51,7 @@
---------------------
First, check that the bug is present in the development version of the
-documentation at <http://python.sourceforge.net/devel-docs/>; we may
+documentation at <http://www.python.org/dev/doc/devel/>; we may
have already fixed it.
If we haven't, tell us about it. We'd like the documentation to be
@@ -143,6 +143,23 @@
<http://www.latex2html.org/>.
+LaTeX (or pdfLaTeX) ran out of memory; how can I fix it?
+--------------------------------------------------------
+
+This is known to be a problem at least on Mac OS X, but it has been
+observed on other systems in the past.
+
+On some systems, the default sizes of some of the memory pools
+allocated by TeX needs to be changed; this is a configuration setting
+for installations based on web2c (most if not all installations).
+This is usually set in a file named texmf/web2c/texmf.cnf (where the
+top-level texmf/ directory is part of the TeX installation). If you
+get a "buffer overflow" warning from LaTeX, open that configuration
+file and look for the "main_memory.pdflatex" setting. If there is not
+one, you can add a line with the setting. The value 1500000 seems to
+be sufficient for formatting the Python documetantion.
+
+
What if Times fonts are not available?
--------------------------------------
Modified: python/python/Doc/branches/2.3.4/commontex/license.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/commontex/license.tex (original)
+++ python/python/Doc/branches/2.3.4/commontex/license.tex Sun May 28 00:23:12 2006
@@ -676,4 +676,3 @@
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.
\end{verbatim}
-
Modified: python/python/Doc/branches/2.3.4/lib/libbinascii.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libbinascii.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libbinascii.tex Sun May 28 00:23:12 2006
@@ -152,4 +152,3 @@
\seemodule{quopri}{Supporto per la codifica quoted-printable usata
in messaggi di posta elettronica MIME.}
\end{seealso}
-
Modified: python/python/Doc/branches/2.3.4/lib/libcd.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libcd.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libcd.tex Sun May 28 00:23:12 2006
@@ -106,11 +106,6 @@
\end{datadesc}
\begin{datadesc}{STILL}
-L'equivalente di \constant{PAUSED} su un vecchio modello Toshiba (non
-3301). dispositivi CD-ROM. Tali dispositivi non sono mai stati venduti
- da SGI.
-
-
L'equivalente di \constant{PAUSED} su vecchi (non 3301) dispositivi
CD-ROM dei modelli Toshiba. Tali dispositivi non sono mai stati
venduti da SGI.
Modified: python/python/Doc/branches/2.3.4/lib/libcurses.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libcurses.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libcurses.tex Sun May 28 00:23:12 2006
@@ -47,6 +47,7 @@
\subsection{Funzioni \label{curses-functions}}
Il modulo \module{curses} definisce la seguente eccezione:
+
\begin{excdesc}{error}
Eccezione sollevata quando una funzione di libreria curses restituisce
un errore.
@@ -856,6 +857,14 @@
(dopo essersi spostata in \var{y}, \var{x}, se specificato).
\end{methoddesc}
+\begin{methoddesc}[window]{insstr}{\optional{y, x, } str \optional{, attr}}
+Inserisce una stringa di caratteri (tanti caratteri quanti ne entrano
+in una linea) prima del carattere sotto il cursore. Tutti i caratteri
+alla destra del cursore sono spostati sulla destra, con i caratteri
+più a destra che vengono persi. La posizione del cursore non cambia
+(dopo essersi mosso verso \var{y}, \var{x}, se specificato).
+\end{methoddesc}
+
\begin{methoddesc}[window]{instr}{\optional{y, x} \optional{, n}}
Restituisce una stringa di caratteri, estratta dalla finestra a
partire dalla posizione corrente del cursore, o da \var{y}, \var{x} se
Modified: python/python/Doc/branches/2.3.4/lib/libdifflib.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libdifflib.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libdifflib.tex Sun May 28 00:23:12 2006
@@ -477,6 +477,7 @@
su \method{ratio()}, ma è più rapido da calcolare sia di
\method{ratio()} che di \method{quick_ratio()}.
\end{methoddesc}
+
I tre metodi che restituiscono il rapporto di corrispondenza rispetto
al totale dei caratteri, possono dare risultati differenti dovuti ai
diversi livelli di approssimazione, anche se \method{quick_ratio()} e
Modified: python/python/Doc/branches/2.3.4/lib/libfuncs.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libfuncs.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libfuncs.tex Sun May 28 00:23:12 2006
@@ -859,6 +859,7 @@
Quando \code{reload(module)} viene eseguito:
\begin{itemize}
+
\item{Il codice del modulo Python viene ricompilato e quindi
eseguito nuovamente il codice a livello di modulo, definendo un
insieme di oggetti che legano i nomi ai dizionari relativi ai
Modified: python/python/Doc/branches/2.3.4/lib/libhttplib.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libhttplib.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libhttplib.tex Sun May 28 00:23:12 2006
@@ -189,7 +189,6 @@
intestazioni \code{Host:} o \code{Accept-Encoding:} (per esempio per
accettare ulteriori codifiche di contenuto), specificare
\var{skip_host} o \var{skip_accept_encoding} con valori non Falsi.
-
\versionchanged[\`E stato aggiunto l'argomento \var{skip_accept_encoding}]{2.4}
\end{methoddesc}
Modified: python/python/Doc/branches/2.3.4/lib/libinspect.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libinspect.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libinspect.tex Sun May 28 00:23:12 2006
@@ -416,4 +416,3 @@
rappresenta il chiamante; l'ultima voce indica dove viene sollevata
l'eccezione.
\end{funcdesc}
-
Modified: python/python/Doc/branches/2.3.4/lib/liboperator.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/liboperator.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/liboperator.tex Sun May 28 00:23:12 2006
@@ -75,7 +75,6 @@
\begin{funcdesc}{is_not}{a, b}
Restituisce \code{\var{a} is not \var{b}}. Verifica l'identità di oggetti.
-
\versionadded{2.3}
\end{funcdesc}
@@ -423,4 +422,3 @@
\lineiii{Uguaglianza}{\code{\var{a} == \var{b}}}
{\code{eq(\var{a}, \var{b})}}
\end{tableiii}
-
Modified: python/python/Doc/branches/2.3.4/lib/liboptparse.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/liboptparse.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/liboptparse.tex Sun May 28 00:23:12 2006
@@ -1517,7 +1517,6 @@
# Notate che che lo stop avviene anche su "-3" o "-3.0",
#+ così se la vostra opzione accetta valori numerici, dovrete
#+ gestirli in questo modo.
-
if ((arg[:2] == "--" and len(arg) > 2) or
(arg[:1] == "-" and len(arg) > 1 and arg[1] != "-")):
break
Modified: python/python/Doc/branches/2.3.4/lib/libpickle.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libpickle.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libpickle.tex Sun May 28 00:23:12 2006
@@ -490,6 +490,7 @@
pickle per l'istanza.
\withsubitem{(copy protocol)}{\ttindex{__getinitargs__()}}
\withsubitem{(instance constructor)}{\ttindex{__init__()}}
+
\withsubitem{(copy protocol)}{\ttindex{__getnewargs__()}}
I tipi di nuovo stile possono fornire il metodo
@@ -715,6 +716,7 @@
intenzione di fornire, un giorno, un'interfaccia comune per
controllare questi comportamenti, che lavorerà sia con
\module{pickle} che con \module{cPickle}.}
+
Nel modulo \module{pickle}, si deve derivare una sotto classe da
\class{Unpickler}, ridefinendo il metodo \method{load_global()}. Tale
metodo dovrebbe leggere due linee dal flusso di dati serializzati, in cui
Modified: python/python/Doc/branches/2.3.4/lib/libsite.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libsite.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libsite.tex Sun May 28 00:23:12 2006
@@ -96,4 +96,3 @@
\code{sys.exec_prefix} sono vuoti, e la manipolazioni dei percorsi
viene saltata; comunque l'importazione di
\module{sitecustomize}\refmodindex{sitecustomize} viene ancora tentata.
-
Modified: python/python/Doc/branches/2.3.4/lib/libstdtypes.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libstdtypes.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libstdtypes.tex Sun May 28 00:23:12 2006
@@ -1435,6 +1435,7 @@
\exception{KeyError} quando nessuna chiave predefinita viene
fornita e la chiave non è stata trovata.
\versionadded{2.3}
+
\item[(9)] \function{update()} accetta sia un altro oggetto mappa che
un iterabile formato da una coppia chiave/valore (come una
tupla o altro iterabile di lunghezza due). Se vengono
Modified: python/python/Doc/branches/2.3.4/lib/libsys.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libsys.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libsys.tex Sun May 28 00:23:12 2006
@@ -280,7 +280,6 @@
Questa funzione dovrebbe essere utilizzata solamente per scopi
speciali o interni (all'interprete).
-
\end{funcdesc}
\begin{funcdesc}{getwindowsversion}{}
Modified: python/python/Doc/branches/2.3.4/lib/libtarfile.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libtarfile.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libtarfile.tex Sun May 28 00:23:12 2006
@@ -491,4 +491,3 @@
tar.extract(tarinfo)
tar.close()
\end{verbatim}
-
Modified: python/python/Doc/branches/2.3.4/lib/libunittest.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/libunittest.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/libunittest.tex Sun May 28 00:23:12 2006
@@ -387,8 +387,6 @@
suite = unittest.makeSuite(WidgetTestCase)
\end{verbatim}
-----
-
Notate che quando si utilizza la funzione \function{makeSuite()},
l'ordine di esecuzione dei vari test case verrà determinato
ordinando i nomi delle funzioni tramite la funzione built-in \function{cmp()}.
@@ -482,7 +480,6 @@
l'interfaccia necessaria al test runner per permettergli di guidare
il test, con metodi che il codice di test può utilizzare per
controllo e per riportare vari tipi di fallimenti.
-
\end{classdesc}
\begin{classdesc}{FunctionTestCase}{testFunc\optional{,
@@ -907,7 +904,6 @@
Il metodo, facoltativamente, risolve \var{name} relativamente al modulo
dato.
-
\end{methoddesc}
\begin{methoddesc}[TestLoader]{loadTestsFromNames}{names\optional{, module}}
Modified: python/python/Doc/branches/2.3.4/lib/xmldomminidom.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/lib/xmldomminidom.tex (original)
+++ python/python/Doc/branches/2.3.4/lib/xmldomminidom.tex Sun May 28 00:23:12 2006
@@ -161,7 +161,6 @@
\versionchanged[Per il nodo \class{Document}, un ulteriore parola
chiave, \var{encoding}, può essere usata per specificare il campo di
codifica dell'intestazione XML]{2.3}
-
\end{methoddesc}
\begin{methoddesc}[Node]{toxml}{\optional{encoding}}
@@ -182,7 +181,6 @@
\versionchanged[è stato introdotto l'argomento di codifica
\var{encoding}]{2.3}
-
\end{methoddesc}
\begin{methoddesc}[Node]{toprettyxml}{\optional{indent\optional{, newl}}}
@@ -192,9 +190,7 @@
alla fine di ogni riga ed il valore predefinito è \\n.
\versionadded{2.1}
-
\versionchanged[per codificare gli argomenti; vedere \method{toxml}]{2.3}
-
\end{methoddesc}
I seguenti metodi standard DOM sono tenuti in speciale considerazione
Modified: python/python/Doc/branches/2.3.4/mac/libmac.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/mac/libmac.tex (original)
+++ python/python/Doc/branches/2.3.4/mac/libmac.tex Sun May 28 00:23:12 2006
@@ -60,4 +60,3 @@
\function{exists()}.
Per le altre funzioni presenti in \module{os.path}, sono accessibili
delle funzioni fittizie equivalenti.
-
Modified: python/python/Doc/branches/2.3.4/mac/using.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/mac/using.tex (original)
+++ python/python/Doc/branches/2.3.4/mac/using.tex Sun May 28 00:23:12 2006
@@ -253,6 +253,7 @@
\end{enumerate}
\subsection{Creare uno script Python}
+
Dato che gli script Python sono semplici file di testo, possono essere
creati in qualsiasi modo si possa creare un file di testo, ma esistono
anche alcuni strumenti con caratteristiche aggiuntive.
@@ -272,6 +273,9 @@
\program{Alpha}, \program{Pepper}, \program{BBedit} e l'IDE MacPython
(Sezione \ref{IDE}).
+%\subsubsection{Alpha}
+% **NEED INFO HERE**
+
\subsubsection{BBedit \label{scripting-with-BBedit}}
Se si usa \program{BBEdit} per creare script lo si dovrà istruire sul Python
@@ -285,6 +289,18 @@
distribuzione MacPython; cliccare ``open''.
\item Cliccare sul bottone ``Save'' nel pannello Preferences.
\end{itemize}
+% Are there additional BBedit Python-specific features? I'm not aware of any.
+
+%\subsubsection{IDE}
+%You can use the \program{Python IDE} supplied in the MacPython Distribution to create longer Python scripts
+%-- see Section \ref{IDEwrite} for details.
+
+%\subsubsection{IDLE}
+%Idle is an IDE for Python that was written in Python, using TKInter. You should be able to use it on a Mac by following
+%the standard documentation, but see Section \ref{TKInter} for guidance on using TKInter with MacPython.
+
+%\subsubsection{Pepper}
+% **NEED INFO HERE**
\subsection{Configurazione \label{configuration}}
@@ -330,6 +346,9 @@
\subsubsection{Opzioni predefinite di partenza \label{defaults}}
+% I'm assuming that there exists some other documentation on the
+% rest of the options so I only go over a couple here.
+
Il bottone ``Default startup options...'' nella dialog box di
\program{EditPythonPrefs} propone molte opzioni, inclusa la possibilità
di mantenere aperta la finestra di ``Output'' anche dopo che uno script
@@ -338,6 +357,29 @@
esaminare gli oggetti che sono stati creati durante l'esecuzione dello
script.
+%\section{Nifty Tools}
+%There are many other tools included with the MacPython
+%distribution. In addition to those discussed here, make
+%sure to check the \file{Mac} directory.
+
+%\subsection{BuildApplet \label{BuildApplet}}
+% **NEED INFO HERE**
+
+%\subsection{BuildApplication}
+% **NEED INFO HERE**
+
+%\section{TKInter on the Mac \label{TKInter}}
+
+%TKinter is installed by default with the MacPython distribution, but
+%you may need to add the \file{lib-tk} folder to the Python Path (see
+%section \ref{search-path}). Also, it is important that you do not
+%try to launch Tk from within the \program{Python IDE} because the two
+%event loops will collide -- always run a script which uses Tkinter
+%with the \program{PythonInterpreter} instead -- see section
+%\ref{interpreter}.
+
+%\section{CGI on the Mac with Python \label{CGI}}
+%**NEED INFO HERE**
\section{L'IDE\label{IDE}}
Modified: python/python/Doc/branches/2.3.4/ref/ref1.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/ref/ref1.tex (original)
+++ python/python/Doc/branches/2.3.4/ref/ref1.tex Sun May 28 00:23:12 2006
@@ -95,4 +95,3 @@
di BNF nel prossimo capitolo (``Analisi Lessicale'') sono definizioni
lessicali; quelle nei capitoli successivi sono definizioni
sintattiche.
-
Modified: python/python/Doc/branches/2.3.4/ref/ref2.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/ref/ref2.tex (original)
+++ python/python/Doc/branches/2.3.4/ref/ref2.tex Sun May 28 00:23:12 2006
@@ -97,7 +97,6 @@
\end{verbatim}
che viene riconosciuta da VIM di Bram Moolenaar.
-
In aggiunta, se il primo byte del file è la maschera di byte-order di
UTF-8 (\code{'\e xef\e xbb\e xbf'}), il file di codifica dichiarata è
UTF-8 (questo è supportato, tra gli altri, dal \program{notepad} di
@@ -750,4 +749,3 @@
\begin{verbatim}
@ $ ?
\end{verbatim}
-
Modified: python/python/Doc/branches/2.3.4/ref/ref3.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/ref/ref3.tex (original)
+++ python/python/Doc/branches/2.3.4/ref/ref3.tex Sun May 28 00:23:12 2006
@@ -1497,9 +1497,8 @@
\exception{AttributeError}. Se è necessaria l'attribuzione dinamica
di una nuova variabile, allora si aggiunge \code{'__dict__'} alla
sequenza di stringhe presenti nella dichiarazione \var{__slots__}.
-
- \versionchanged[\code{'__dict__'} aggiunto alla dichiarazione
- \var{__slots__} non abiliterà l'assegnamento di nuove variabili non
+ \versionchanged[Precedentemente, \code{'__dict__'} aggiunto alla dichiarazione
+ \var{__slots__} non avrebbe abilitato l'assegnamento di nuove variabili non
elencate specificatamente nella sequenza dei nomi delle variabili
d'istanza.]{2.3}
Modified: python/python/Doc/branches/2.3.4/ref/ref5.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/ref/ref5.tex (original)
+++ python/python/Doc/branches/2.3.4/ref/ref5.tex Sun May 28 00:23:12 2006
@@ -79,7 +79,6 @@
\strong{Private name mangling:}
\indexii{name}{mangling}%
\indexii{private}{names}%
-
Quando un identificatore viene rinvenuto testualmente nella
definizione di una classe e comincia con due o più caratteri
underscore ma non termina con due o più underscore, viene considerato
Modified: python/python/Doc/branches/2.3.4/ref/ref6.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/ref/ref6.tex (original)
+++ python/python/Doc/branches/2.3.4/ref/ref6.tex Sun May 28 00:23:12 2006
@@ -50,7 +50,6 @@
sezione~\ref{print}). (Le espressioni di istruzioni che producono
\code{None} non vengono scritte, quindi queste procedure non causano
alcun output).
-
\obindex{None}
\indexii{string}{conversion}
\index{output}
Modified: python/python/Doc/branches/2.3.4/tut/glossary.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/tut/glossary.tex (original)
+++ python/python/Doc/branches/2.3.4/tut/glossary.tex Sun May 28 00:23:12 2006
@@ -369,4 +369,3 @@
``\code{import this}''.
\end{description}
-
Modified: python/python/Doc/branches/2.3.4/whatsnew/whatsnew24.tex
==============================================================================
--- python/python/Doc/branches/2.3.4/whatsnew/whatsnew24.tex (original)
+++ python/python/Doc/branches/2.3.4/whatsnew/whatsnew24.tex Sun May 28 00:23:12 2006
@@ -1,11 +1,14 @@
\documentclass{howto}
\usepackage{distutils}
-% $Id: whatsnew24.tex,v 1.21 2003/12/18 13:28:13 akuchling Exp $
+% $Id: whatsnew24.tex,v 1.44 2004/05/19 08:20:04 rhettinger Exp $
\title{What's New in Python 2.4}
\release{0.0}
\author{A.M.\ Kuchling}
-\authoraddress{\email{amk a amk.ca}}
+\authoraddress{
+ \strong{Python Software Foundation}\\
+ Email: \email{amk a amk.ca}
+}
\begin{document}
\maketitle
@@ -30,8 +33,8 @@
%======================================================================
\section{PEP 218: Built-In Set Objects}
-Two new built-in types, \function{set(iterable)} and
-\function{frozenset(iterable)} provide high speed data types for
+Two new built-in types, \function{set(\var{iterable})} and
+\function{frozenset(\var{iterable})} provide high speed data types for
membership testing, for eliminating duplicates from sequences, and
for mathematical operations like unions, intersections, differences,
and symmetric differences.
@@ -70,6 +73,10 @@
like \method{add()} and \method{remove()} which could alter its contents.
% XXX what happens to the sets module?
+% The current thinking is that the sets module will be left alone.
+% That way, existing code will continue to run without alteration.
+% Also, the module provides an autoconversion feature not supported by set()
+% and frozenset().
\begin{seealso}
\seepep{218}{Adding a Built-In Set Object Type}{Originally proposed by
@@ -82,9 +89,87 @@
XXX write this.
%======================================================================
+\section{PEP 229: Generator Expressions}
+
+Generator expressions create in-line generators using a syntax similar
+to list comprehensions but with parenthesis instead of the surrounding
+brackets.
+
+Genexps allow simple generators to be constructed without a separate function
+definition. Writing:
+
+\begin{verbatim}
+ g = (tgtexp for var1 in exp1 for var2 in exp2 if exp3)
+\end{verbatim}
+
+is equivalent to:
+
+\begin{verbatim}
+ def _generator(exp):
+ for var1 in exp:
+ for var2 in exp2:
+ if exp3:
+ yield tgtexp
+ g = _generator(exp1)
+ del _generator
+\end{verbatim}
+
+The advantage over full generator definitions is in economy of
+expression. Their advantage over list comprehensions is in saving
+memory by creating data only when it is needed rather than forming
+a whole list is memory all at once. Applications using memory
+friendly generator expressions may scale-up to high volumes of data
+more readily than with list comprehensions.
+
+Generator expressions are intended to be used inside functions
+such as \function{sum()}, \function{min()}, \function{set()}, and
+\function{dict()}. These functions consume their data all at once
+and would not benefit from having a full list instead of a generator
+an input:
+
+\begin{verbatim}
+>>> sum(i*i for i in range(10))
+285
+
+>>> sorted(set(i*i for i in xrange(-10, 11)))
+[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
+
+>>> words = "Adam apple baker Bill Nancy NASA nut".split()
+>>> dict((word.lower(), word) for word in words)
+{'apple': 'apple', 'baker': 'baker', 'bill': 'Bill', 'nasa': 'NASA',
+ 'adam': 'Adam', 'nancy': 'Nancy', 'nut': 'nut'}
+
+>>> xvec = [10, 20, 30]
+>>> yvec = [7, 5, 3]
+>>> sum(x*y for x,y in itertools.izip(xvec, yvec)) # dot product
+260
+
+\end{verbatim}
+
+These examples show the intended use for generator expressions
+in situations where the values get consumed immediately after the
+generator is created. In these situations, they operate like
+memory efficient versions of list comprehensions.
+
+For more complex uses of generators, it is strongly recommended that
+the traditional full generator definitions be used instead. In a
+generator expression, the first for-loop expression is evaluated
+as soon as the expression is defined while the other expressions do
+not get evaluated until the generator is run. This nuance is never
+an issue when the generator is used immediately. If it is not used
+right away, then it is better to write a full generator definition
+which more clearly reveals when the expressions are evaluated and is
+more obvious about the visibility and lifetime of its looping variables.
+
+\begin{seealso}
+\seepep{289}{Generator Expressions}{Proposed by Raymond Hettinger and
+implemented by Jiwon Seo with early efforts steered by Hye-Shik Chang.}
+\end{seealso}
+
+%======================================================================
\section{PEP 322: Reverse Iteration}
-A new built-in function, \function{reversed(seq)}, takes a sequence
+A new built-in function, \function{reversed(\var{seq})}, takes a sequence
and returns an iterator that returns the elements of the sequence
in reverse order.
@@ -105,7 +190,7 @@
a list with \function{list()}.
\begin{verbatim}
->>> input = open('/etc/passwd', 'r')
+>>> input= open('/etc/passwd', 'r')
>>> for line in reversed(list(input)):
... print line
...
@@ -127,19 +212,24 @@
\begin{itemize}
+\item The \method{dict.update()} method now accepts the same
+argument forms as the \class{dict} constructor. This includes any
+mapping, any iterable of key/value pairs, and/or keyword arguments.
+
\item The string methods, \method{ljust()}, \method{rjust()}, and
\method{center()} now take an optional argument for specifying a
fill character other than a space.
\item Strings also gained an \method{rsplit()} method that
-works like the \method{split()} method but splits from the end of the string.
+works like the \method{split()} method but splits from the end of
+the string.
\begin{verbatim}
->>> 'a b c'.split(None, 1)
-['a', 'b c']
->>> 'a b c'.rsplit(None, 1)
-['a b', 'c']
-\end{verbatim}
+>>> 'www.python.org'.split('.', 1)
+['www', 'python.org']
+'www.python.org'.rsplit('.', 1)
+['www.python', 'org']
+\end{verbatim}
\item The \method{sort()} method of lists gained three keyword
arguments, \var{cmp}, \var{key}, and \var{reverse}. These arguments
@@ -169,7 +259,7 @@
\end{verbatim}
The last example, which uses the \var{cmp} parameter, is the old way
-to perform a case-insensitive sort. It works, but is slower than
+to perform a case-insensitive sort. It works but is slower than
using a \var{key} parameter. Using \var{key} results in calling the
\method{lower()} method once for each element in the list while using
\var{cmp} will call the method twice for each comparison.
@@ -196,9 +286,10 @@
and then sort the list by age, resulting in a list sorted by age where
people with the same age are in name-sorted order.
-\item There is a new built-in function \function{sorted(iterable)} that works
-like the in-place \method{list.sort()} method but has been made suitable
-for use in expressions. The differences are:
+\item There is a new built-in function
+\function{sorted(\var{iterable})} that works like the in-place
+\method{list.sort()} method but has been made suitable for use in
+expressions. The differences are:
\begin{itemize}
\item the input may be any iterable;
\item a newly formed copy is sorted, leaving the original intact; and
@@ -230,7 +321,7 @@
\item The \function{zip()} built-in function and \function{itertools.izip()}
now return an empty list instead of raising a \exception{TypeError}
- exception if called with no arguments. This makes the functions more
+ exception if called with no arguments. This makes them more
suitable for use with variable length argument lists:
\begin{verbatim}
@@ -251,7 +342,40 @@
\begin{itemize}
-\item Optimizations should be described here.
+\item The inner loops for \class{list} and \class{tuple} slicing
+ were optimized and now run about one-third faster. The inner
+ loops were also optimized for \class{dict} with performance
+ boosts to \method{keys()}, \method{values()}, \method{items()},
+\method{iterkeys()}, \method{itervalues()}, and \method{iteritems()}.
+
+\item The machinery for growing and shrinking lists was optimized
+ for speed and for space efficiency. Small lists (under eight elements)
+ never over-allocate by more than three elements. Large lists do not
+ over-allocate by more than 1/8th. Appending and popping from lists
+ now runs faster due to more efficient code paths and less frequent
+ use of the underlying system realloc(). List comprehensions also
+ benefit. The amount of improvement varies between systems and shows
+ the greatest improvement on systems with poor realloc() implementations.
+ \method{list.extend()} was also optimized and no longer converts its
+ argument into a temporary list prior to extending the base list.
+
+\item \function{list()}, \function{tuple()}, \function{map()},
+ \function{filter()}, and \function{zip()} now run several times
+ faster with non-sequence arguments that supply a \method{__len__()}
+ method. Previously, the pre-sizing optimization only applied to
+ sequence arguments.
+
+\item The methods \method{list.__getitem__()},
+ \method{dict.__getitem__()}, and \method{dict.__contains__()} are
+ are now implemented as \class{method_descriptor} objects rather
+ than \class{wrapper_descriptor} objects. This form of optimized
+ access doubles their performance and makes them more suitable for
+ use as arguments to functionals:
+ \samp{map(mydict.__getitem__, keylist)}.
+
+\item Added an newcode opcode, \code{LIST_APPEND}, that simplifies
+ the generated bytecode for list comprehensions and speeds them up
+ by about a third.
\end{itemize}
@@ -277,8 +401,58 @@
supports transparency, this makes it possible to use a transparent background.
(Contributed by J\"org Lehmann.)
+\item The \module{bisect} module now has an underlying C implementation
+ for improved performance.
+ (Contributed by Dmitry Vasiliev.)
+
+\item The CJKCodecs collections of East Asian codecs, maintained
+by Hye-Shik Chang, was integrated into 2.4.
+The new encodings are:
+
+\begin{itemize}
+ \item Chinese (PRC): gb2312, gbk, gb18030, hz
+ \item Chinese (ROC): big5, cp950
+ \item Japanese: cp932, shift-jis, shift-jisx0213, euc-jp,
+euc-jisx0213, iso-2022-jp, iso-2022-jp-1, iso-2022-jp-2,
+ iso-2022-jp-3, iso-2022-jp-ext
+ \item Korean: cp949, euc-kr, johab, iso-2022-kr
+\end{itemize}
+
+\item There is a new \module{collections} module for
+ various specialized collection datatypes.
+ Currently it contains just one type, \class{deque},
+ a double-ended queue that supports efficiently adding and removing
+ elements from either end.
+
+\begin{verbatim}
+>>> from collections import deque
+>>> d = deque('ghi') # make a new deque with three items
+>>> d.append('j') # add a new entry to the right side
+>>> d.appendleft('f') # add a new entry to the left side
+>>> d # show the representation of the deque
+deque(['f', 'g', 'h', 'i', 'j'])
+>>> d.pop() # return and remove the rightmost item
+'j'
+>>> d.popleft() # return and remove the leftmost item
+'f'
+>>> list(d) # list the contents of the deque
+['g', 'h', 'i']
+>>> 'h' in d # search the deque
+True
+\end{verbatim}
+
+Several modules now take advantage of \class{collections.deque} for
+improved performance: \module{Queue}, \module{mutex}, \module{shlex}
+\module{threading}, and \module{pydoc}.
+
+\item The \module{ConfigParser} classes have been enhanced slightly.
+ The \method{read()} method now returns a list of the files that
+ were successfully parsed, and the \method{set()} method raises
+ \exception{TypeError} if passed a \var{value} argument that isn't a
+ string.
+
\item The \module{heapq} module has been converted to C. The resulting
- ten-fold improvement in speed makes the module suitable for handling
+ tenfold improvement in speed makes the module suitable for handling
high volumes of data.
\item The \module{imaplib} module now supports IMAP's THREAD command.
@@ -319,36 +493,41 @@
\begin{verbatim}
>>> word = 'abracadabra'
->>> letters = sorted(word) # Turn string into sorted list of letters
+>>> letters = sorted(word) # Turn string into a sorted list of letters
>>> letters
['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r']
->>> [k for k, g in groupby(word)] # List unique letters
+>>> [k for k, g in groupby(letters)] # List unique letters
['a', 'b', 'c', 'd', 'r']
->>> [(k, len(list(g))) for k, g in groupby(word)] # Count letter occurences
+>>> [(k, len(list(g))) for k, g in groupby(letters)] # Count letter occurences
[('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)]
->>> [k for k, g in groupby(word) if len(list(g)) > 1] # List duplicate letters
+>>> [k for k, g in groupby(letters) if len(list(g)) > 1] # List duplicated letters
['a', 'b', 'r']
\end{verbatim}
-\item \module{itertools} also gained a function named \function{tee(\var{iterator}, \var{N})} that returns \var{N} independent iterators
-that replicate \var{iterator}. If \var{N} is omitted, the default is
-2.
+\item \module{itertools} also gained a function named
+\function{tee(\var{iterator}, \var{N})} that returns \var{N} independent
+iterators that replicate \var{iterator}. If \var{N} is omitted, the
+default is 2.
\begin{verbatim}
>>> L = [1,2,3]
>>> i1, i2 = itertools.tee(L)
>>> i1,i2
(<itertools.tee object at 0x402c2080>, <itertools.tee object at 0x402c2090>)
->>> list(i1)
+>>> list(i1) # Run the first iterator to exhaustion
[1, 2, 3]
->>> list(i2)
+>>> list(i2) # Run the second iterator to exhaustion
[1, 2, 3]
>\end{verbatim}
Note that \function{tee()} has to keep copies of the values returned
-by the iterator; in the worst case it may need to keep all of them.
-This should therefore be used carefully if \var{iterator}
-returns a very large stream of results.
+by the iterator; in the worst case, it may need to keep all of them.
+This should therefore be used carefully if the leading iterator
+can run far ahead of the trailing iterator in a long stream of inputs.
+If the separation is large, then it becomes preferable to use
+\function{list()} instead. When the iterators track closely with one
+another, \function{tee()} is ideal. Possible applications include
+bookmarking, windowing, or lookahead iterators.
\item A new \function{getsid()} function was added to the
\module{posix} module that underlies the \module{os} module.
@@ -357,26 +536,24 @@
\item The \module{operator} module gained two new functions,
\function{attrgetter(\var{attr})} and \function{itemgetter(\var{index})}.
Both functions return callables that take a single argument and return
-the corresponding attribute or item; these callables are handy for use
-with \function{map()} or \function{list.sort()}. For example, here's a simple
-us
+the corresponding attribute or item; these callables make excellent
+data extractors when used with \function{map()} or \function{sorted()}.
+For example:
\begin{verbatim}
->>> L = [('c', 2), ('d', 1), ('a', '4'), ('b', 3)]
+>>> L = [('c', 2), ('d', 1), ('a', 4), ('b', 3)]
>>> map(operator.itemgetter(0), L)
['c', 'd', 'a', 'b']
>>> map(operator.itemgetter(1), L)
-[2, 1, '4', 3]
->>> L.sort(key=operator.itemgetter(1)) # Sort list by second item in tuples
->>> L
-[('d', 1), ('c', 2), ('b', 3), ('a', '4')]
+[2, 1, 4, 3]
+>>> sorted(L, key=operator.itemgetter(1)) # Sort list by second tuple item
+[('d', 1), ('c', 2), ('b', 3), ('a', 4)]
\end{verbatim}
\item The \module{random} module has a new method called \method{getrandbits(N)}
which returns an N-bit long integer. This method supports the existing
\method{randrange()} method, making it possible to efficiently generate
- arbitrarily large random numbers (suitable for prime number generation in
- RSA applications).
+ arbitrarily large random numbers.
\item The regular expression language accepted by the \module{re} module
was extended with simple conditional expressions, written as
@@ -404,13 +581,18 @@
values from extension functions: \csimplemacro{Py_RETURN_NONE},
\csimplemacro{Py_RETURN_TRUE}, and \csimplemacro{Py_RETURN_FALSE}.
- \item A new function, \cfunction{PyTuple_Pack(N, obj1, obj2, ...,
- objN)}, constructs tuples from a variable length argument list of
- Python objects.
-
- \item A new function, \cfunction{PyDict_Contains(d, k)}, implements
- fast dictionary lookups without masking exceptions raised during the
- look-up process.
+ \item A new function, \cfunction{PyTuple_Pack(\var{N}, \var{obj1},
+ \var{obj2}, ..., \var{objN})}, constructs tuples from a variable
+ length argument list of Python objects.
+
+ \item A new function, \cfunction{PyDict_Contains(\var{d}, \var{k})},
+ implements fast dictionary lookups without masking exceptions raised
+ during the look-up process.
+
+ \item A new method flag, \constant{METH_COEXISTS}, allows a function
+ defined in slots to co-exist with a PyCFunction having the same name.
+ This can halve the access to time to a method such as
+ \method{set.__contains__()}
\end{itemize}
@@ -418,7 +600,11 @@
%======================================================================
\subsection{Port-Specific Changes}
-Platform-specific changes go here.
+\begin{itemize}
+
+\item The Windows port now builds under MSVC++ 7.1 as well as version 6.
+
+\end{itemize}
%======================================================================
@@ -433,7 +619,14 @@
\begin{itemize}
-\item Details go here.
+\item The \module{timeit} module now automatically disables periodic
+ garbarge collection during the timing loop. This change makes
+ consecutive timings more comparable.
+
+\item The \module{base64} module now has more complete RFC 3548 support
+ for Base64, Base32, and Base16 encoding and decoding, including
+ optional case folding and optional alternative alphabets.
+ (Contributed by Barry Warsaw.)
\end{itemize}
@@ -453,6 +646,10 @@
\item \function{dircache.listdir()} now passes exceptions to the caller
instead of returning empty lists.
+\item \function{LexicalHandler.startDTD()} used to receive public and
+ system ID in the wrong order. This has been corrected; applications
+ relying on the wrong order need to be fixed.
+
\end{itemize}
More information about the Commits
mailing list