Credit patch from Raymond
This commit is contained in:
parent
8278860e52
commit
7642f7af0d
|
@ -756,11 +756,13 @@ language.
|
|||
|
||||
\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 keyword arguments.
|
||||
mapping, any iterable of key/value pairs, and keyword arguments.
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\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.
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\item Strings also gained an \method{rsplit()} method that
|
||||
works like the \method{split()} method but splits from the end of
|
||||
|
@ -776,6 +778,7 @@ the string.
|
|||
\item The \method{sort()} method of lists gained three keyword
|
||||
arguments: \var{cmp}, \var{key}, and \var{reverse}. These arguments
|
||||
make some common usages of \method{sort()} simpler. All are optional.
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\var{cmp} is the same as the previous single argument to
|
||||
\method{sort()}; if provided, the value should be a comparison
|
||||
|
@ -860,6 +863,8 @@ red 1
|
|||
yellow 5
|
||||
\end{verbatim}
|
||||
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\item Integer operations will no longer trigger an \exception{OverflowWarning}.
|
||||
The \exception{OverflowWarning} warning will disappear in Python 2.5.
|
||||
|
||||
|
@ -884,7 +889,8 @@ Python dictionary. (Contributed by Raymond Hettinger.)
|
|||
>>> transpose([])
|
||||
[]
|
||||
\end{verbatim}
|
||||
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\item Encountering a failure while importing a module no longer leaves
|
||||
a partially-initialized module object in \code{sys.modules}. The
|
||||
incomplete module object left behind would fool further imports of the
|
||||
|
@ -892,6 +898,7 @@ same module into succeeding, leading to confusing errors.
|
|||
|
||||
\item \constant{None} is now a constant; code that binds a new value to
|
||||
the name \samp{None} is now a syntax error.
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\end{itemize}
|
||||
|
||||
|
@ -906,6 +913,7 @@ the name \samp{None} is now a syntax error.
|
|||
were also optimized for dictionaries, resulting in performance boosts for
|
||||
\method{keys()}, \method{values()}, \method{items()},
|
||||
\method{iterkeys()}, \method{itervalues()}, and \method{iteritems()}.
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\item The machinery for growing and shrinking lists was optimized for
|
||||
speed and for space efficiency. Appending and popping from lists now
|
||||
|
@ -913,12 +921,12 @@ the name \samp{None} is now a syntax error.
|
|||
the underlying system \cfunction{realloc()}. List comprehensions
|
||||
also benefit. \method{list.extend()} was also optimized and no
|
||||
longer converts its argument into a temporary list before extending
|
||||
the base list.
|
||||
the base list. (Contributed by Raymond Hettinger.)
|
||||
|
||||
\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.
|
||||
method. (Contributed by Raymond Hettinger.)
|
||||
|
||||
\item The methods \method{list.__getitem__()},
|
||||
\method{dict.__getitem__()}, and \method{dict.__contains__()} are
|
||||
|
@ -927,10 +935,11 @@ the name \samp{None} is now a syntax error.
|
|||
access doubles their performance and makes them more suitable for
|
||||
use as arguments to functionals:
|
||||
\samp{map(mydict.__getitem__, keylist)}.
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\item Added a new opcode, \code{LIST_APPEND}, that simplifies
|
||||
the generated bytecode for list comprehensions and speeds them up
|
||||
by about a third.
|
||||
by about a third. (Contributed by Raymond Hettinger.)
|
||||
|
||||
\item String concatenations in statements of the form \code{s = s +
|
||||
"abc"} and \code{s += "abc"} are now performed more efficiently in
|
||||
|
@ -938,6 +947,7 @@ certain circumstances. This optimization won't be present in other
|
|||
Python implementations such as Jython, so you shouldn't rely on it;
|
||||
using the \method{join()} method of strings is still recommended when
|
||||
you want to efficiently glue a large number of strings together.
|
||||
(Contributed by Armin Rigo.)
|
||||
|
||||
\end{itemize}
|
||||
|
||||
|
@ -1015,7 +1025,7 @@ True
|
|||
|
||||
Several modules now take advantage of \class{collections.deque} for
|
||||
improved performance, such as the \module{Queue} and
|
||||
\module{threading} modules.
|
||||
\module{threading} modules. (Contributed by Raymond Hettinger.)
|
||||
|
||||
\item The \module{ConfigParser} classes have been enhanced slightly.
|
||||
The \method{read()} method now returns a list of the files that
|
||||
|
@ -1044,7 +1054,7 @@ any problems as a \member{defect} attribute of the message.
|
|||
high volumes of data. In addition, the module has two new functions
|
||||
\function{nlargest()} and \function{nsmallest()} that use heaps to
|
||||
find the N largest or smallest values in a dataset without the
|
||||
expense of a full sort.
|
||||
expense of a full sort. (Contributed by Raymond Hettinger.)
|
||||
|
||||
\item The \module{imaplib} module now supports IMAP's THREAD command
|
||||
(contributed by Yves Dionne) and new \method{deleteacl()} and
|
||||
|
@ -1103,6 +1113,8 @@ r ['r', 'r']
|
|||
[('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)]
|
||||
\end{verbatim}
|
||||
|
||||
(Contributed by Hye-Shik Chang.)
|
||||
|
||||
\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
|
||||
|
@ -1127,6 +1139,7 @@ If the separation is large, then you might as well use
|
|||
\function{list()} instead. When the iterators track closely with one
|
||||
another, \function{tee()} is ideal. Possible applications include
|
||||
bookmarking, windowing, or lookahead iterators.
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\item A number of functions were added to the \module{locale}
|
||||
module, such as \function{bind_textdomain_codeset()} to specify a
|
||||
|
@ -1176,6 +1189,8 @@ data extractors when used with \function{map()} or
|
|||
[('d', 1), ('c', 2), ('b', 3), ('a', 4)]
|
||||
\end{verbatim}
|
||||
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\item The \module{optparse} module was updated. The module now passes
|
||||
its messages through \function{gettext.gettext()}, making it possible
|
||||
to internationalize Optik's help and error messages. Help messages
|
||||
|
@ -1203,12 +1218,14 @@ not it's a symbolic link. This differs from the existing
|
|||
\item The \module{poplib} module now supports POP over SSL.
|
||||
|
||||
\item The \module{profile} module can now profile C extension functions.
|
||||
% XXX more to say about this?
|
||||
% XXX more to say about this?
|
||||
(Contributed by Nick Bastin.)
|
||||
|
||||
\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.
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\item The regular expression language accepted by the \module{re} module
|
||||
was extended with simple conditional expressions, written as
|
||||
|
@ -1261,11 +1278,12 @@ Other threads can assign and retrieve their own values for the
|
|||
|
||||
\item The \module{timeit} module now automatically disables periodic
|
||||
garbarge collection during the timing loop. This change makes
|
||||
consecutive timings more comparable.
|
||||
consecutive timings more comparable. (Contributed by Raymond Hettinger.)
|
||||
|
||||
\item The \module{weakref} module now supports a wider variety of objects
|
||||
including Python functions, class instances, sets, frozensets, deques,
|
||||
arrays, files, sockets, and regular expression pattern objects.
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\item The \module{xmlrpclib} module now supports a multi-call extension for
|
||||
transmitting multiple XML-RPC calls in a single HTTP operation.
|
||||
|
@ -1315,18 +1333,19 @@ Changes to Python's build process and to the C API include:
|
|||
\item Three new convenience macros were added for common return
|
||||
values from extension functions: \csimplemacro{Py_RETURN_NONE},
|
||||
\csimplemacro{Py_RETURN_TRUE}, and \csimplemacro{Py_RETURN_FALSE}.
|
||||
(Contributed by Brett Cannon.)
|
||||
|
||||
\item Another new macro, \csimplemacro{Py_CLEAR(\var{obj})},
|
||||
decreases the reference count of \var{obj} and sets \var{obj} to the
|
||||
null pointer.
|
||||
null pointer. (Contributed by Jim Fulton.)
|
||||
|
||||
\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.
|
||||
length argument list of Python objects. (Contributed by Raymond Hettinger.)
|
||||
|
||||
\item A new function, \cfunction{PyDict_Contains(\var{d}, \var{k})},
|
||||
implements fast dictionary lookups without masking exceptions raised
|
||||
during the look-up process.
|
||||
during the look-up process. (Contributed by Raymond Hettinger.)
|
||||
|
||||
\item A new function, \cfunction{PyArg_VaParseTupleAndKeywords()},
|
||||
is the same as \cfunction{PyArg_ParseTupleAndKeywords()} but takes a
|
||||
|
@ -1336,7 +1355,7 @@ Changes to Python's build process and to the C API include:
|
|||
\item A new method flag, \constant{METH_COEXISTS}, allows a function
|
||||
defined in slots to co-exist with a \ctype{PyCFunction} having the
|
||||
same name. This can halve the access time for a method such as
|
||||
\method{set.__contains__()}.
|
||||
\method{set.__contains__()}. (Contributed by Raymond Hettinger.)
|
||||
|
||||
\item Python can now be built with additional profiling for the
|
||||
interpreter itself. This is intended for people developing on the
|
||||
|
@ -1359,6 +1378,7 @@ Changes to Python's build process and to the C API include:
|
|||
\begin{itemize}
|
||||
|
||||
\item The Windows port now builds under MSVC++ 7.1 as well as version 6.
|
||||
(Contributed by Martin von Loewis.)
|
||||
|
||||
\end{itemize}
|
||||
|
||||
|
@ -1375,6 +1395,7 @@ changes to your code:
|
|||
\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.
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
\item \function{dircache.listdir()} now passes exceptions to the caller
|
||||
instead of returning empty lists.
|
||||
|
|
Loading…
Reference in New Issue