diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-04-11 16:12:57 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-04-11 16:12:57 (GMT) |
commit | 08bf91c0416c7409634164b7d449f2e5a0f3ebde (patch) | |
tree | d12c5c56bb05c33a2e8244a9287099b42a09d9e1 /Doc/whatsnew/2.7.rst | |
parent | 40b0c9ac4db521494eac8874d457556d1dfb81b1 (diff) | |
download | cpython-08bf91c0416c7409634164b7d449f2e5a0f3ebde.zip cpython-08bf91c0416c7409634164b7d449f2e5a0f3ebde.tar.gz cpython-08bf91c0416c7409634164b7d449f2e5a0f3ebde.tar.bz2 |
Merged revisions 79307,79408,79430,79533,79542,79579-79580,79585-79587,79607-79608,79622,79717,79820,79822,79828,79862,79875,79923-79924,79941-79943,79945,79947,79951-79952 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79307 | florent.xicluna | 2010-03-22 17:45:50 -0500 (Mon, 22 Mar 2010) | 2 lines
#7667: Fix doctest failures with non-ASCII paths.
........
r79408 | victor.stinner | 2010-03-24 20:18:38 -0500 (Wed, 24 Mar 2010) | 2 lines
Fix a gcc warning introduced by r79397.
........
r79430 | brian.curtin | 2010-03-25 18:48:54 -0500 (Thu, 25 Mar 2010) | 2 lines
Fix #6538. Markup RegexObject and MatchObject as classes. Patch by Ryan Arana.
........
r79533 | barry.warsaw | 2010-03-31 16:07:16 -0500 (Wed, 31 Mar 2010) | 6 lines
- Issue #8233: When run as a script, py_compile.py optionally takes a single
argument `-` which tells it to read files to compile from stdin. Each line
is read on demand and the named file is compiled immediately. (Original
patch by Piotr O?\197?\188arowski).
........
r79542 | r.david.murray | 2010-03-31 20:28:39 -0500 (Wed, 31 Mar 2010) | 3 lines
A couple small grammar fixes in test.rst, and rewrite the
check_warnings docs to be clearer.
........
r79579 | georg.brandl | 2010-04-02 03:34:41 -0500 (Fri, 02 Apr 2010) | 1 line
Add 2.6.5.
........
r79580 | georg.brandl | 2010-04-02 03:39:09 -0500 (Fri, 02 Apr 2010) | 1 line
#2768: add a note on how to get a file descriptor.
........
r79585 | georg.brandl | 2010-04-02 04:03:18 -0500 (Fri, 02 Apr 2010) | 1 line
Remove col-spanning cells in logging docs.
........
r79586 | georg.brandl | 2010-04-02 04:07:42 -0500 (Fri, 02 Apr 2010) | 1 line
Document PyImport_ExecCodeModuleEx().
........
r79587 | georg.brandl | 2010-04-02 04:11:49 -0500 (Fri, 02 Apr 2010) | 1 line
#8012: clarification in generator glossary entry.
........
r79607 | andrew.kuchling | 2010-04-02 12:48:23 -0500 (Fri, 02 Apr 2010) | 1 line
#6647: document that catch_warnings is not thread-safe
........
r79608 | andrew.kuchling | 2010-04-02 12:54:26 -0500 (Fri, 02 Apr 2010) | 1 line
#6647: add note to two examples
........
r79622 | tarek.ziade | 2010-04-02 16:34:19 -0500 (Fri, 02 Apr 2010) | 1 line
removed documentation on code that was reverted and pushed into distutils2
........
r79717 | antoine.pitrou | 2010-04-03 16:22:38 -0500 (Sat, 03 Apr 2010) | 4 lines
Fix wording / typography, and a slightly misleading statement
(memoryviews don't support complex structures right now)
........
r79820 | benjamin.peterson | 2010-04-05 22:34:09 -0500 (Mon, 05 Apr 2010) | 1 line
ready _sre types
........
r79822 | georg.brandl | 2010-04-06 03:18:15 -0500 (Tue, 06 Apr 2010) | 1 line
#8320: document return value of recv_into().
........
r79828 | georg.brandl | 2010-04-06 09:33:44 -0500 (Tue, 06 Apr 2010) | 1 line
Add JP.
........
r79862 | georg.brandl | 2010-04-06 15:27:59 -0500 (Tue, 06 Apr 2010) | 1 line
Fix syntax.
........
r79875 | mark.dickinson | 2010-04-06 17:18:23 -0500 (Tue, 06 Apr 2010) | 1 line
More NaN consistency doc fixes.
........
r79923 | georg.brandl | 2010-04-10 06:15:24 -0500 (Sat, 10 Apr 2010) | 1 line
#8360: skipTest was added in 2.7.
........
r79924 | georg.brandl | 2010-04-10 06:16:59 -0500 (Sat, 10 Apr 2010) | 1 line
#8346: update version.
........
r79941 | andrew.kuchling | 2010-04-10 20:39:36 -0500 (Sat, 10 Apr 2010) | 1 line
Two grammar fixes
........
r79942 | andrew.kuchling | 2010-04-10 20:40:06 -0500 (Sat, 10 Apr 2010) | 1 line
Punctuation fix
........
r79943 | andrew.kuchling | 2010-04-10 20:40:30 -0500 (Sat, 10 Apr 2010) | 1 line
Add various items
........
r79945 | andrew.kuchling | 2010-04-10 20:40:49 -0500 (Sat, 10 Apr 2010) | 1 line
name correct
........
r79947 | andrew.kuchling | 2010-04-10 20:44:13 -0500 (Sat, 10 Apr 2010) | 1 line
Remove distutils section
........
r79951 | andrew.kuchling | 2010-04-11 07:48:08 -0500 (Sun, 11 Apr 2010) | 1 line
Two typo fixes
........
r79952 | andrew.kuchling | 2010-04-11 07:49:37 -0500 (Sun, 11 Apr 2010) | 1 line
Add two items
........
Diffstat (limited to 'Doc/whatsnew/2.7.rst')
-rw-r--r-- | Doc/whatsnew/2.7.rst | 140 |
1 files changed, 82 insertions, 58 deletions
diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst index dcea4f2..593c9fa 100644 --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -10,6 +10,7 @@ .. Big jobs: argparse, ElementTree 1.3, pep 391, 3106, sysconfig .. unittest test discovery +.. hyperlink all the methods & functions. .. $Id$ Rules for maintenance: @@ -238,10 +239,33 @@ module, but it's easier to use. PEP 389: The argparse Module for Parsing Command Lines ====================================================== -XXX write this section. +The :mod:`argparse` module for parsing command-line arguments was +added, intended as a more powerful replacement for the +:mod:`optparse` module. + +This means Python now supports three different modules for parsing +command-line arguments: :mod:`getopt`, :mod:`optparse`, and +:mod:`argparse`. The :mod:`getopt` module closely resembles the C +:cfunc:`getopt` function, so it remains useful if you're writing a +Python prototype that will eventually be rewritten in C. +:mod:`optparse` becomes redundant, but there are no plans to remove it +because there are many scripts still using it, and there's no +automated way to update these scripts. (Making the :mod:`argparse` +API consistent with :mod:`optparse`'s interface was discussed but +rejected as too messy and difficult.) + +To summarize, if you're writing a new script and don't need to worry +about compatibility with earlier versions of Python, use +:mod:`argparse` instead of :mod:`optparse`. + +XXX need an example .. seealso:: + `argparse module documentation <http://docs.python.org/dev/library/argparse.html>`__ + + `Upgrading optparse code to use argparse <http://docs.python.org/dev/library/argparse.html#upgrading-optparse-code>`__ + :pep:`389` - argparse - New Command Line Parsing Module PEP written and implemented by Steven Bethard. @@ -478,6 +502,29 @@ Some smaller changes made to the core Python language are: .. ====================================================================== +.. _new-27-interpreter: + +Interpreter Changes +------------------------------- + +A new environment variable, :envvar:`PYTHONWARNINGS`, +allows controlling warnings. It should be set to a string +containing warning settings, equivalent to those +used with the :option:`-W` switch, separated by commas. +(Contributed by Brian Curtin; :issue:`7301`.) + +For example, the following setting will print warnings every time +they occur, but turn warnings from the :mod:`Cookie` module into an +error. (The exact syntax for setting an environment variable varies +across operating systems and shells, so it may be different for you.) + +:: + + export PYTHONWARNINGS=all,error:::Cookie:0 + + +.. ====================================================================== + Optimizations ------------- @@ -671,10 +718,13 @@ changes, or look through the Subversion logs for all the details. (Added by Raymond Hettinger; :issue:`1818`.) - The :class:`~collections.deque` data type now exposes its maximum length as the - read-only :attr:`~collections.deque.maxlen` attribute, and has a - :meth:`~collections.deque.reverse` method that reverses the elements of the deque in-place. - (Added by Raymond Hettinger.) + The :class:`~collections.deque` data type now has a + :meth:`~collections.deque.count` method that returns the number of + contained elements equal to the supplied argument *x*, and a + :meth:`~collections.deque.reverse` method that reverses the elements + of the deque in-place. :class:`deque` also exposes its maximum + length as the read-only :attr:`~collections.deque.maxlen` attribute. + (Both features added by Raymond Hettinger.) * The :mod:`copy` module's :func:`~copy.deepcopy` function will now correctly copy bound instance methods. (Implemented by @@ -720,6 +770,12 @@ changes, or look through the Subversion logs for all the details. as arguments to its constructor. (Implemented by Mark Dickinson; :issue:`5812`.) + An oversight was fixed, making the :class:`Fraction` match the other + numeric types; ordering comparisons (``<``, ``<=``, ``>``, ``>=``) between + fractions and complex numbers now raise a :exc:`TypeError`. + + .. revision 79455 + * New class: a new :class:`~ftplib.FTP_TLS` class in the :mod:`ftplib` module provides secure FTP connections using TLS encapsulation of authentication as well as @@ -730,6 +786,21 @@ changes, or look through the Subversion logs for all the details. uploads thanks to an added *rest* parameter (patch by Pablo Mouzo; :issue:`6845`.) +* New class decorator: :func:`total_ordering` in the :mod:`functools` + module takes a class that defines an :meth:`__eq__` method and one of + :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`, + and generates the missing comparison methods. Since the + :meth:`__cmp__` method is being deprecated in Python 3.x, + this decorator makes it easier to define ordered classes. + (Added by Raymond Hettinger; :issue:`5479`.) + + New function: :func:`cmp_to_key` will take an old-style comparison + function that expects two arguments and return a new callable that + can be used as the *key* parameter to functions such as + :func:`sorted`, :func:`min` and :func:`max`, etc. The primary + intended use is to help with making code compatible with Python 3.x. + (Added by Raymond Hettinger.) + * New function: the :mod:`gc` module's :func:`~gc.is_tracked` returns true if a given instance is tracked by the garbage collector, false otherwise. (Contributed by Antoine Pitrou; :issue:`4688`.) @@ -905,7 +976,12 @@ changes, or look through the Subversion logs for all the details. * The :mod:`socket` module's :class:`~ssl.SSL` objects now support the buffer API, which fixed a test suite failure. (Fixed by Antoine - Pitrou; :issue:`7133`.) + Pitrou; :issue:`7133`.) The version of OpenSSL being used is + now available as the module attributes + :attr:`OPENSSL_VERSION` (a string), + :attr:`OPENSSL_VERSION_INFO` (a 5-tuple), and + :attr:`OPENSSL_VERSION_NUMBER` (an integer). (Added by Antoine Pitrou; + :issue:`8321`.) The :func:`~socket.create_connection` function gained a *source_address* parameter, a ``(host, port)`` 2-tuple @@ -1057,58 +1133,6 @@ XXX write this. .. whole new modules get described in subsections here -Distutils Enhancements ---------------------------------- - -XXX all of this work has been moved to Distutils2 -XXX Not sure what we should say here - -Distutils is being more actively developed, thanks to Tarek Ziadé -who has taken over maintenance of the package, so there are a number -of fixes and improvements. - -A new :file:`setup.py` subcommand, ``check``, will check that the -arguments being passed to the :func:`setup` function are complete -and correct (:issue:`5732`). - -Byte-compilation by the ``install_lib`` subcommand is now only done -if the ``sys.dont_write_bytecode`` setting allows it (:issue:`7071`). - -:func:`distutils.sdist.add_defaults` now uses -*package_dir* and *data_files* to create the MANIFEST file. -:mod:`distutils.sysconfig` now reads the :envvar:`AR` and -:envvar:`ARFLAGS` environment variables. - -.. ARFLAGS done in #5941 - -It is no longer mandatory 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 Ziadé, -based on an initial contribution by Nathan Van Gheem; :issue:`4394`.) - -A Distutils setup can now specify that a C extension is optional by -setting the *optional* option setting to true. If this optional is -supplied, failure to build the extension will not abort the build -process, but instead simply not install the failing extension. -(Contributed by Georg Brandl; :issue:`5583`.) - -The :class:`distutils.dist.DistributionMetadata` class' -:meth:`read_pkg_file` method will read the contents of a package's -:file:`PKG-INFO` metadata file. For an example of its use, see -:ref:`reading-metadata`. -(Contributed by Tarek Ziadé; :issue:`7457`.) - -:file:`setup.py` files will now accept a :option:`--no-user-cfg` switch -to skip reading the :file:`~/.pydistutils.cfg` file. (Suggested by -by Michael Hoffman, and implemented by Paul Winkler; :issue:`1180`.) - -When creating a tar-format archive, the ``sdist`` subcommand now -allows specifying the user id and group that will own the files in the -archives using the :option:`--owner` and :option:`--group` switches -(:issue:`6516`). - - Unit Testing Enhancements --------------------------------- |