diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2008-01-15 01:47:32 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2008-01-15 01:47:32 (GMT) |
commit | 2e463552804d7b43792b942f9fc6ea7c8306577b (patch) | |
tree | 6c5a80ea62af4ba39bcbdd874e800e76a0fb6580 /Doc | |
parent | f15ff46be5e012557dd3d7f18ce7540affe2f49c (diff) | |
download | cpython-2e463552804d7b43792b942f9fc6ea7c8306577b.zip cpython-2e463552804d7b43792b942f9fc6ea7c8306577b.tar.gz cpython-2e463552804d7b43792b942f9fc6ea7c8306577b.tar.bz2 |
Add many items
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/whatsnew/2.6.rst | 138 |
1 files changed, 131 insertions, 7 deletions
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index f31ebf7..50ca2b3 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -426,6 +426,29 @@ can now be used in scripts running from inside a package. .. ====================================================================== +.. :: + + .. _pep-0370: + + PEP 370: XXX + ===================================================== + + When you run Python, the module search page ``sys.modules`` usually + includes a directory whose path ends in ``"site-packages"``. This + directory is intended to hold locally-installed packages available to + all users on a machine or using a particular site installation. + + Python 2.6 introduces a convention for user-specific site directories. + + .. seealso:: + + :pep:`370` - XXX + + PEP written by XXX; implemented by Christian Heimes. + + +.. ====================================================================== + .. _pep-3110: PEP 3110: Exception-Handling Changes @@ -650,6 +673,16 @@ Here are all of the changes that Python 2.6 makes to the core Python language. Optimizations ------------- +* Type objects now have a cache of methods that can reduc + the amount of work required to find the correct method implementation + for a particular class; the interpreter may not need to traverse base + classes + + (Original optimization implemented by Armin Rigo, updated for + Python 2.6 by Kevin Jacobs.) + + .. % Patch 1700288 + * All of the functions in the :mod:`struct` module have been rewritten in C, thanks to work at the Need For Speed sprint. (Contributed by Raymond Hettinger.) @@ -700,6 +733,11 @@ complete list of changes, or look through the CVS logs for all the details. >>> v2 variable(id=1, name='amplitude', type='int', size=4) + Where the new :class:`namedtuple` type proved suitable, the standard + library has been modified to return them. For example, + the :meth:`Decimal.as_tuple` method now returns a named tuple with + :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields. + (Contributed by Raymond Hettinger.) * Another change to the :mod:`collections` module is that the @@ -758,7 +796,17 @@ complete list of changes, or look through the CVS logs for all the details. >>> Decimal(1000).log10() Decimal("3") - (Implemented by Facundo Batista and Mark Dickinson.) + The :meth:`as_tuple` method of :class:`Decimal` objects now returns a + named tuple with :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields. + + (Implemented by Facundo Batista and Mark Dickinson. Named tuple + support added by Raymond Hettinger.) + +* The :mod:`difflib` module's :class:`SequenceMatcher` class + now returns named tuples representing matches. + In addition to behaving like tuples, the returned values + also have :attr:`a`, :attr:`b`, and :attr:`size` attributes. + (Contributed by Raymond Hettinger.) * An optional ``timeout`` parameter was added to the :class:`ftplib.FTP` class constructor as well as the :meth:`connect` @@ -795,6 +843,12 @@ complete list of changes, or look through the CVS logs for all the details. class constructors, specifying a timeout measured in seconds. (Added by Facundo Batista.) +* Most of the :mod:`inspect` module's functions, such as + :func:`getmoduleinfo` and :func:`getargs`, now return named tuples. + In addition to behaving like tuples, the elements of the return value + can also be accessed as attributes. + (Contributed by Raymond Hettinger.) + * A new function in the :mod:`itertools` module: ``izip_longest(iter1, iter2, ...[, fillvalue])`` makes tuples from each of the elements; if some of the iterables are shorter than others, the missing values are set to *fillvalue*. @@ -891,6 +945,13 @@ complete list of changes, or look through the CVS logs for all the details. .. Issue 1727780 +* Long regular expression searches carried out by the :mod:`re` + module will now check for signals being delivered, so especially + long searches can now be interrupted. + (Contributed by Josh Hoyt and Ralf Schmitt.) + + .. % Patch 846388 + * The :mod:`rgbimg` module has been removed. * The :mod:`sets` module has been deprecated; it's better to @@ -934,6 +995,13 @@ complete list of changes, or look through the CVS logs for all the details. .. Patch #957003 +* The :mod:`socket` module now supports TIPC (http://tipc.sf.net), + a high-performance non-IP-based protocol designed for use in clustered + environments. TIPC addresses are 4- or 5-tuples. + (Contributed by Alberto Bertogli.) + + .. Patch #1646 + * A new variable in the :mod:`sys` module, :attr:`float_info`, is an object containing information about the platform's floating-point support @@ -945,6 +1013,21 @@ complete list of changes, or look through the CVS logs for all the details. .. Patch 1534 + Information about the command-line arguments supplied to the Python + interpreter are available as attributes of a ``sys.flags`` named + tuple. For example, the :attr:`verbose` attribute is true if Python + was executed in verbose mode, :attr:`debug` is true in debugging mode, etc. + These attributes are all read-only. + (Contributed by Christian Heimes.) + + The :attr:`dont_write_bytecode` variable controls whether Python + writes any :file:`.pyc` or :file:`.pyo` files on importing a module. + If this variable is true, the compiled files are not written. The + variable can be set by Python code, by supplying the :option:`-B` + switch, or by setting the :envvar:`PYTHONDONTWRITEBYTECODE` + environment variable to any non-empty string when running the Python + interpreter. + * The :mod:`tarfile` module now supports POSIX.1-2001 (pax) and POSIX.1-1988 (ustar) format tarfiles, in addition to the GNU tar format that was already supported. The default format @@ -1061,6 +1144,22 @@ complete list of changes, or look through the CVS logs for all the details. information. (Contributed by Alan McIntyre as part of his project for Google's Summer of Code 2007.) +* The :mod:`zipfile` module's :class:`ZipFile` class now has + :meth:`extract` and :meth:`extractall` methods that will unpack + a single file or all the files in the archive to the current directory, or + to a specified directory:: + + z = zipfile.ZipFile('python-251.zip') + + # Unpack a single file, writing it relative to the /tmp directory. + z.extract('Python/sysmodule.c', '/tmp') + + # Unpack all the files in the archive. + z.extractall() + + (Contributed by Alan McIntyre.) + .. % Patch 467924 + .. ====================================================================== .. whole new modules get described in subsections here @@ -1143,7 +1242,12 @@ Port-Specific Changes: Windows value, as does the :func:`getwche` function. The :func:`putwch` function takes a Unicode character and writes it to the console. -Platform-specific changes go here. +* The :mod:`_winreg` module now has a function, + :func:`ExpandEnvironmentStrings`, + that expands environment variable references such as ``%NAME%`` + in an input string. The handle objects provided by this + module now support the context protocol, so they can be used + in :keyword:`with` statements. .. ====================================================================== @@ -1153,14 +1257,21 @@ Platform-specific changes go here. Other Changes and Fixes ======================= -As usual, there were a bunch of other improvements and bugfixes scattered -throughout the source tree. A search through the change logs finds there were -XXX patches applied and YYY bugs fixed between Python 2.5 and 2.6. Both figures -are likely to be underestimates. +As usual, there were a bunch of other improvements and bugfixes +scattered throughout the source tree. A search through the change +logs finds there were XXX patches applied and YYY bugs fixed between +Python 2.5 and 2.6. Both figures are likely to be underestimates. Some of the more notable changes are: -* Details will go here. +* It's now possible to prevent Python from writing any :file:`.pyc` + or :file:`.pyo` files by either supplying the :option:`-B` switch + or setting the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable + to any non-empty string when running the Python interpreter. These + are used to set a :attr:`dont_write_bytecode` variable in the + :mod:`sys` module. Python code can change this variable to + control whether bytecode files are subsequently written. + (Contributed by Neal Norwitz and Georg Brandl.) .. ====================================================================== @@ -1177,6 +1288,19 @@ code: before adding elements from the iterable. This change makes the behavior match that of ``list.__init__()``. +* The :class:`Decimal` constructor now accepts leading and trailing + whitespace when passed a string. Previously it would raise an + :exc:`InvalidOperation` exception. On the other hand, the + :meth:`create_decimal` method of :class:`Context` objects now + explicitly disallows extra whitespace, raising a + :exc:`ConversionSyntax` exception. + +* Due to an implementation accident, if you passed a file path to + the built-in :func:`__import__` function, it would actually import + the specified file. This was never intended to work, however, and + the implementation now explicitly checks for this case and raises + an :exc:`ImportError`. + * The :mod:`socket` module exception :exc:`socket.error` now inherits from :exc:`IOError`. Previously it wasn't a subclass of :exc:`StandardError` but now it is, through :exc:`IOError`. |