diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-01-30 04:00:29 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-01-30 04:00:29 (GMT) |
commit | 1010bf3e2690ea665ed0fae5b1f0a6f959040441 (patch) | |
tree | 738f0bf0d9fa2498bd8253f1a013dda457cdb3a3 /Doc/whatsnew/2.7.rst | |
parent | c4bbc8d7dc0992b37855e1e7173bab16b32a752d (diff) | |
download | cpython-1010bf3e2690ea665ed0fae5b1f0a6f959040441.zip cpython-1010bf3e2690ea665ed0fae5b1f0a6f959040441.tar.gz cpython-1010bf3e2690ea665ed0fae5b1f0a6f959040441.tar.bz2 |
Merged revisions 68840,68881,68943,68945 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68840 | andrew.kuchling | 2009-01-20 20:15:43 -0600 (Tue, 20 Jan 2009) | 1 line
Add some items
........
r68881 | andrew.kuchling | 2009-01-23 21:28:18 -0600 (Fri, 23 Jan 2009) | 1 line
Add various items
........
r68943 | tarek.ziade | 2009-01-25 16:09:10 -0600 (Sun, 25 Jan 2009) | 1 line
Issue #5052: removed backward compatibility information (out of date)
........
r68945 | tarek.ziade | 2009-01-25 16:11:04 -0600 (Sun, 25 Jan 2009) | 1 line
added missing module docstring
........
Diffstat (limited to 'Doc/whatsnew/2.7.rst')
-rw-r--r-- | Doc/whatsnew/2.7.rst | 99 |
1 files changed, 86 insertions, 13 deletions
diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst index b76829c..6c65d0b 100644 --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -6,6 +6,8 @@ :Release: |release| :Date: |today| +.. Fix accents on Kristjan Valur Jonsson, Fuerstenau. + .. $Id$ Rules for maintenance: @@ -60,11 +62,6 @@ No release schedule has been decided yet for 2.7. .. ======================================================================== -Kristján Valur Jónsson, issue 4293 -Py_AddPendingCall is now thread safe. This allows any worker thread -to submit notifications to the python main thread. This is particularly -useful for asynchronous IO operations. - Other Language Changes ====================== @@ -95,7 +92,19 @@ Some smaller changes made to the core Python language are: Optimizations ------------- -To be written. +A few performance enhancements have been added: + +* The garbage collector now performs better when many objects are + being allocated without deallocating any. A full garbage collection + pass is only performed when the middle generation has been collected + 10 times and when the number of survivor objects from the middle + generation exceeds 10% of the number of objects in the oldest + generation. The second condition was added to reduce the number + of full garbage collections as the number of objects on the heap grows, + avoiding quadratic performance when allocating very many objects. + (Suggested by Martin von Loewis and implemented by Antoine Pitrou; + :issue:`4074`.) + .. ====================================================================== @@ -108,6 +117,62 @@ changes, sorted alphabetically by module name. Consult the :file:`Misc/NEWS` file in the source tree for a more complete list of changes, or look through the Subversion logs for all the details. +* It is not mandatory anymore to store clear text passwords in the + :file:`.pypirc` file when registering and uploading packages to PyPI. As long + as the username is present in that file, the :mod:`distutils` package will + prompt for the password if not present. (Added by tarek, with the initial + contribution of Nathan Van Gheem; :issue:`4394`.) + +* The :mod:`bz2` module's :class:`BZ2File` now supports the context + management protocol, so you can write ``with bz2.BZ2File(...) as f: ...``. + (Contributed by Hagen Fuerstenau; :issue:`3860`.) + +* A new :class:`Counter` class in the :mod:`collections` module is + useful for tallying data. :class:`Counter` instances behave mostly + like dictionaries but return zero for missing keys instead of + raising a :exc:`KeyError`:: + + >>> from collections import Counter + >>> c=Counter() + >>> for letter in 'here is a sample of english text': + ... c[letter] += 1 + ... + >>> c + Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2, + 'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1, + 'p': 1, 'r': 1, 'x': 1}) + >>> c['e'] + 5 + >>> c['z'] + 0 + + There are two additional :class:`Counter` methods: :meth:`most_common` + returns the N most common elements and their counts, and :meth:`elements` + returns an iterator over the contained element, repeating each element + as many times as its count:: + + >>> c.most_common(5) + [(' ', 6), ('e', 5), ('s', 3), ('a', 2), ('i', 2)] + >>> c.elements() -> + 'a', 'a', ' ', ' ', ' ', ' ', ' ', ' ', + 'e', 'e', 'e', 'e', 'e', 'g', 'f', 'i', 'i', + 'h', 'h', 'm', 'l', 'l', 'o', 'n', 'p', 's', + 's', 's', 'r', 't', 't', 'x'] + + Contributed by Raymond Hettinger; :issue:`1696199`. + +* The :mod:`gzip` module's :class:`GzipFile` now supports the context + management protocol, so you can write ``with gzip.GzipFile(...) as f: ...``. + (Contributed by Hagen Fuerstenau; :issue:`3860`.) + +* The :class:`io.FileIO` class now raises an :exc:`OSError` when passed + an invalid file descriptor. (Implemented by Benjamin Peterson; + :issue:`4991`.) + +* The :mod:`pydoc` module now has help for the various symbols that Python + uses. You can now do ``help('<<')`` or ``help('@')``, for example. + (Contributed by David Laban; :issue:`4739`.) + * A new function in the :mod:`subprocess` module, :func:`check_output`, runs a command with a specified set of arguments and returns the command's output as a string if the command runs without @@ -125,11 +190,9 @@ changes, or look through the Subversion logs for all the details. (Contributed by Gregory P. Smith.) -* It is not mandatory anymore to store clear text passwords in the - :file:`.pypirc` file when registering and uploading packages to PyPI. As long - as the username is present in that file, the :mod:`distutils` package will - prompt for the password if not present. (Added by tarek, with the initial - contribution of Nathan Van Gheem; :issue:`4394`.) +* The :func:`is_zipfile` function in the :mod:`zipfile` module will now + accept a file object, in addition to the path names accepted in earlier + versions. (Contributed by Gabriel Genellina; :issue:`4756`.) .. ====================================================================== .. whole new modules get described in subsections here @@ -145,7 +208,13 @@ Changes to Python's build process and to the C API include: * If you use the :file:`.gdbinit` file provided with Python, the "pyo" macro in the 2.7 version will now work when the thread being debugged doesn't hold the GIL; the macro will now acquire it before printing. - (Contributed by haypo XXX; :issue:`3632`.) + (Contributed by Victor Stinner; :issue:`3632`.) + +* :cfunc:`Py_AddPendingCall` is now thread safe, letting any + worker thread submit notifications to the main Python thread. This + is particularly useful for asynchronous IO operations. + (Contributed by Kristjan Valur Jonsson; :issue:`4293`.) + .. ====================================================================== @@ -157,7 +226,11 @@ Port-Specific Changes: Windows :data:`CRT_ASSEMBLY_VERSION`, :data:`VC_ASSEMBLY_PUBLICKEYTOKEN`, and :data:`LIBRARIES_ASSEMBLY_NAME_PREFIX`. - (Added by Martin von Loewis (XXX check); :issue:`4365`.) + (Contributed by David Cournapeau; :issue:`4365`.) + +* The new :cfunc:`_beginthreadex` API is used to start threads, and + the native thread-local storage functions are now used. + (Contributed by Kristjan Valur Jonsson; :issue:`3582`.) .. ====================================================================== |