Kaydet (Commit) 17ae2ba7 authored tarafından Andrew M. Kuchling's avatar Andrew M. Kuchling

Add various items

üst 2b210699
...@@ -53,6 +53,11 @@ This article explains the new features in Python 2.7. The final ...@@ -53,6 +53,11 @@ This article explains the new features in Python 2.7. The final
release of 2.7 is currently scheduled for June 2010; the detailed release of 2.7 is currently scheduled for June 2010; the detailed
schedule is described in :pep:`373`. schedule is described in :pep:`373`.
Python 2.7 is planned to be the last major release in the 2.x series.
Though more major releases have not been absolutely ruled out, it's
likely that the 2.7 release will have an extended period of
maintenance compared to earlier 2.x versions.
.. Compare with previous release in 2 - 3 sentences here. .. Compare with previous release in 2 - 3 sentences here.
add hyperlink when the documentation becomes available online. add hyperlink when the documentation becomes available online.
...@@ -458,10 +463,12 @@ Several performance enhancements have been added: ...@@ -458,10 +463,12 @@ Several performance enhancements have been added:
conversion function that supports arbitrary bases. conversion function that supports arbitrary bases.
(Patch by Gawain Bolton; :issue:`6713`.) (Patch by Gawain Bolton; :issue:`6713`.)
* The :meth:`rindex`, :meth:`rpartition`, and :meth:`rsplit` methods * The :meth:`split`, :meth:`replace`, :meth:`rindex`,
of string objects now uses a fast reverse-search algorithm instead of :meth:`rpartition`, and :meth:`rsplit` methods of string-like types
a character-by-character scan. This is often faster by a factor of 10. (strings, Unicode strings, and :class:`bytearray` objects) now use a
(Added by Florent Xicluna; :issue:`7462`.) fast reverse-search algorithm instead of a character-by-character
scan. This is sometimes faster by a factor of 10. (Added by
Florent Xicluna; :issue:`7462` and :issue:`7622`.)
* The :mod:`pickle` and :mod:`cPickle` modules now automatically * The :mod:`pickle` and :mod:`cPickle` modules now automatically
intern the strings used for attribute names, reducing memory usage intern the strings used for attribute names, reducing memory usage
...@@ -648,6 +655,10 @@ changes, or look through the Subversion logs for all the details. ...@@ -648,6 +655,10 @@ changes, or look through the Subversion logs for all the details.
recorded in a gzipped file by providing an optional timestamp to recorded in a gzipped file by providing an optional timestamp to
the constructor. (Contributed by Jacques Frechet; :issue:`4272`.) the constructor. (Contributed by Jacques Frechet; :issue:`4272`.)
Files in gzip format can be padded with trailing zero bytes; the
:mod:`gzip` module will now consume these trailing bytes. (Fixed by
Tadek Pietraszek and Brian Curtin; :issue:`2846`.)
* The default :class:`HTTPResponse` class used by the :mod:`httplib` module now * The default :class:`HTTPResponse` class used by the :mod:`httplib` module now
supports buffering, resulting in much faster reading of HTTP responses. supports buffering, resulting in much faster reading of HTTP responses.
(Contributed by Kristjan Valur Jonsson; :issue:`4879`.) (Contributed by Kristjan Valur Jonsson; :issue:`4879`.)
...@@ -667,7 +678,9 @@ changes, or look through the Subversion logs for all the details. ...@@ -667,7 +678,9 @@ changes, or look through the Subversion logs for all the details.
The :class:`io.FileIO` class now raises an :exc:`OSError` when passed The :class:`io.FileIO` class now raises an :exc:`OSError` when passed
an invalid file descriptor. (Implemented by Benjamin Peterson; an invalid file descriptor. (Implemented by Benjamin Peterson;
:issue:`4991`.) :issue:`4991`.) The :meth:`truncate` method now preserves the
file position; previously it would change the file position to the
end of the new file. (Fixed by Pascal Chambon; :issue:`6939`.)
* New function: ``itertools.compress(data, selectors)`` takes two * New function: ``itertools.compress(data, selectors)`` takes two
iterators. Elements of *data* are returned if the corresponding iterators. Elements of *data* are returned if the corresponding
...@@ -723,6 +736,14 @@ changes, or look through the Subversion logs for all the details. ...@@ -723,6 +736,14 @@ changes, or look through the Subversion logs for all the details.
passed to the callable. passed to the callable.
(Contributed by lekma; :issue:`5585`.) (Contributed by lekma; :issue:`5585`.)
The :class:`Pool` class, which controls a pool of worker processes,
now has an optional *maxtasksperchild* parameter. Worker processes
will perform the specified number of tasks and then exit, causing the
:class:`Pool` to start a new worker. This is useful if tasks may leak
memory or other resources, or if some tasks will cause the worker to
become very large.
(Contributed by Charles Cazabon; :issue:`6963`.)
* The :mod:`nntplib` module now supports IPv6 addresses. * The :mod:`nntplib` module now supports IPv6 addresses.
(Contributed by Derek Morr; :issue:`1664`.) (Contributed by Derek Morr; :issue:`1664`.)
...@@ -735,6 +756,10 @@ changes, or look through the Subversion logs for all the details. ...@@ -735,6 +756,10 @@ changes, or look through the Subversion logs for all the details.
contributed by Travis H.; :issue:`6508`. Support for initgroups added contributed by Travis H.; :issue:`6508`. Support for initgroups added
by Jean-Paul Calderone; :issue:`7333`.) by Jean-Paul Calderone; :issue:`7333`.)
The :func:`normpath` function now preserves Unicode; if its input path
is a Unicode string, the return value is also a Unicode string.
(Fixed by Matt Giuca; :issue:`5827`.)
* The :mod:`pydoc` module now has help for the various symbols that Python * The :mod:`pydoc` module now has help for the various symbols that Python
uses. You can now do ``help('<<')`` or ``help('@')``, for example. uses. You can now do ``help('<<')`` or ``help('@')``, for example.
(Contributed by David Laban; :issue:`4739`.) (Contributed by David Laban; :issue:`4739`.)
...@@ -800,8 +825,15 @@ changes, or look through the Subversion logs for all the details. ...@@ -800,8 +825,15 @@ changes, or look through the Subversion logs for all the details.
(Contributed by Jeremy Hylton.) (Contributed by Jeremy Hylton.)
* The ``sys.version_info`` value is now a named tuple, with attributes * The ``sys.version_info`` value is now a named tuple, with attributes
named ``major``, ``minor``, ``micro``, ``releaselevel``, and ``serial``. named :attr:`major`, :attr:`minor`, :attr:`micro`,
(Contributed by Ross Light; :issue:`4285`.) :attr:`releaselevel`, and :attr:`serial`. (Contributed by Ross
Light; :issue:`4285`.)
:func:`sys.getwindowsversion` also returns a named tuple,
with attributes named :attr:`service_pack_major`,
:attr:`service_pack_minor`,
:attr:`suite_mask`, and :attr:`product_type`. (Contributed by
Brian Curtin; :issue:`7766`.)
* The :mod:`tarfile` module's default error handling has changed, to * The :mod:`tarfile` module's default error handling has changed, to
no longer suppress fatal errors. The default error level was previously 0, no longer suppress fatal errors. The default error level was previously 0,
...@@ -828,14 +860,20 @@ changes, or look through the Subversion logs for all the details. ...@@ -828,14 +860,20 @@ changes, or look through the Subversion logs for all the details.
a timeout was provided and the operation timed out. a timeout was provided and the operation timed out.
(Contributed by Tim Lesher; :issue:`1674032`.) (Contributed by Tim Lesher; :issue:`1674032`.)
* The :class:`UserDict` class is now a new-style class. (Changed by
Benjamin Peterson.)
* The :mod:`zipfile` module's :class:`ZipFile` now supports the context * The :mod:`zipfile` module's :class:`ZipFile` now supports the context
management protocol, so you can write ``with zipfile.ZipFile(...) as f: ...``. management protocol, so you can write ``with zipfile.ZipFile(...) as f: ...``.
(Contributed by Brian Curtin; :issue:`5511`.) (Contributed by Brian Curtin; :issue:`5511`.)
:mod:`zipfile` now supports archiving empty directories and :mod:`zipfile` now supports archiving empty directories and
extracts them correctly. (Fixed by Kuba Wieczorek; :issue:`4710`.) extracts them correctly. (Fixed by Kuba Wieczorek; :issue:`4710`.)
Reading files out of an archive is now faster, and interleaving
:meth:`read` and :meth:`readline` now works correctly.
(Contributed by Nir Aides; :issue:`7610`.)
The :func:`is_zipfile` function in the :mod:`zipfile` module now The :func:`is_zipfile` function in the module now
accepts a file object, in addition to the path names accepted in earlier accepts a file object, in addition to the path names accepted in earlier
versions. (Contributed by Gabriel Genellina; :issue:`4756`.) versions. (Contributed by Gabriel Genellina; :issue:`4756`.)
...@@ -1063,10 +1101,12 @@ Changes to Python's build process and to the C API include: ...@@ -1063,10 +1101,12 @@ Changes to Python's build process and to the C API include:
instruction currently executing, and then look up the line number instruction currently executing, and then look up the line number
corresponding to that address. (Added by Jeffrey Yasskin.) corresponding to that address. (Added by Jeffrey Yasskin.)
* New function: :cfunc:`PyLong_AsLongAndOverflow` approximates a Python long * New functions: :cfunc:`PyLong_AsLongAndOverflow` and
integer as a C :ctype:`long`. If the number is too large to fit into :cfunc:`PyLong_AsLongLongAndOverflow` approximates a Python long
a :ctype:`long`, an *overflow* flag is set and returned to the caller. integer as a C :ctype:`long` or :ctype:`long long`.
(Contributed by Case Van Horsen; :issue:`7528`.) If the number is too large to fit into
the output type, an *overflow* flag is set and returned to the caller.
(Contributed by Case Van Horsen; :issue:`7528` and :issue:`7767`.)
* New function: stemming from the rewrite of string-to-float conversion, * New function: stemming from the rewrite of string-to-float conversion,
a new :cfunc:`PyOS_string_to_double` function was added. The old a new :cfunc:`PyOS_string_to_double` function was added. The old
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment