Add various items

This commit is contained in:
Andrew M. Kuchling 2007-09-25 00:09:42 +00:00
parent 6d407e4d3d
commit 99479ebf9e
1 changed files with 104 additions and 17 deletions

View File

@ -75,7 +75,23 @@ Python 3.0
.. % XXX add general comment about Python 3.0 features in 2.6
.. % XXX mention -3 switch
The development cycle for Python 2.6 also saw the release of the first
alphas of Python 3.0, and the development of 3.0 has influenced
a number of features in 2.6.
Python 3.0 is a far-ranging redesign of Python that breaks
compatibility with the 2.x series. This means that existing Python
code will need a certain amount of conversion in order to run on
Python 3.0. However, not all the changes in 3.0 necessarily break
compatibility. In cases where new features won't cause existing code
to break, they've been backported to 2.6 and are described in this
document in the appropriate place. Some of the 3.0-derived features
are:
* A :meth:`__complex__` method for converting objects to a complex number.
* Alternate syntax for catching exceptions: ``except TypeError as exc``.
* The addition of :func:`functools.reduce` as a synonym for the built-in
:func:`reduce` function.
A new command-line switch, :option:`-3`, enables warnings
about features that will be removed in Python 3.0. You can run code
@ -406,11 +422,6 @@ Other Language Changes
Here are all of the changes that Python 2.6 makes to the core Python language.
* Changes to the :class:`Exception` interface
as dictated by :pep:`352` continue to be made. For 2.6,
the :attr:`message` attribute is being deprecated in favor of the
:attr:`args` attribute.
* When calling a function using the ``**`` syntax to provide keyword
arguments, you are no longer required to use a Python dictionary;
any mapping will now work::
@ -426,8 +437,29 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
.. % Patch 1686487
* The built-in types now have improved support for extended slicing syntax,
where various combinations of ``(start, stop, step)`` are supplied.
Previously, the support was partial and certain corner cases wouldn't work.
(Implemented by Thomas Wouters.)
.. % Revision 57619
* C functions and methods that use
:cfunc:`PyComplex_AsCComplex` will now accept arguments that
have a :meth:`__complex__` method. In particular, the functions in the
:mod:`cmath` module will now accept objects with this method.
This is a backport of a Python 3.0 change.
(Contributed by Mark Dickinson.)
.. % Patch #1675423
* Changes to the :class:`Exception` interface
as dictated by :pep:`352` continue to be made. For 2.6,
the :attr:`message` attribute is being deprecated in favor of the
:attr:`args` attribute.
* The :func:`compile` built-in function now accepts keyword arguments
as well as positional parameters. (Contributed by XXX.)
as well as positional parameters. (Contributed by Thomas Wouters.)
.. % Patch 1444529
@ -487,17 +519,32 @@ complete list of changes, or look through the CVS logs for all the details.
fieldnames)` is a factory function that creates subclasses of the standard tuple
whose fields are accessible by name as well as index. For example::
var_type = collections.NamedTuple('variable',
'id name type size')
var = var_type(1, 'frequency', 'int', 4)
>>> var_type = collections.NamedTuple('variable',
... 'id name type size')
# Names are separated by spaces or commas.
# 'id, name, type, size' would also work.
>>> var_type.__fields__
('id', 'name', 'type', 'size')
print var[0], var.id # Equivalent
print var[2], var.type # Equivalent
>>> var = var_type(1, 'frequency', 'int', 4)
>>> print var[0], var.id # Equivalent
1 1
>>> print var[2], var.type # Equivalent
int int
>>> v2 = var.__replace__('name', 'amplitude')
>>> v2
variable(id=1, name='amplitude', type='int', size=4)
(Contributed by Raymond Hettinger.)
* The :mod:`ctypes` module now supports a :class:`c_bool` datatype
that represents the C99 ``bool`` type. (Contributed by David Remahl.)
.. % Patch 1649190
* A new method in the :mod:`curses` module: for a window, :meth:`chgat` changes
the display characters for a certain number of characters on a single line. ::
the display characters for a certain number of characters on a single line.
::
# Boldface text starting at y=0,x=21
# and affecting the rest of the line.
@ -505,11 +552,33 @@ complete list of changes, or look through the CVS logs for all the details.
(Contributed by Fabian Kreutz.)
* The :mod:`decimal` module was updated to version 1.66 of
`the General Decimal Specification <http://www2.hursley.ibm.com/decimal/decarith.html>`__. New features
include some methods for some basic mathematical functions such as
:meth:`exp` and :meth:`log10`::
>>> Decimal(1).exp()
Decimal("2.718281828459045235360287471")
>>> Decimal("2.7182818").ln()
Decimal("0.9999999895305022877376682436")
>>> Decimal(1000).log10()
Decimal("3")
(Implemented by Facundo Batista and Mark Dickinson.)
* An optional ``timeout`` parameter was added to the
:class:`ftplib.FTP` class constructor as well as the :meth:`connect`
method, specifying a timeout measured in seconds. (Added by Facundo
Batista.)
* The :func:`reduce` built-in function is also available in the
:mod:`functools` module. In Python 3.0, the built-in is dropped and it's
only available from :mod:`functools`; currently there are no plans
to drop the built-in in the 2.x series. (Patched by
Christian Heimes.)
.. % Patch 1739906
* The :func:`glob.glob` function can now return Unicode filenames if
a Unicode path was used and Unicode filenames are matched within the directory.
@ -548,7 +617,7 @@ complete list of changes, or look through the CVS logs for all the details.
.. % Patch #1490190
* The :func:`os.walk` function now has a "followlinks" parameter. If
* The :func:`os.walk` function now has a ``followlinks`` parameter. If
set to True, it will follow symlinks pointing to directories and
visit the directory's contents. For backward compatibility, the
parameter's default value is false. Note that the function can fall
@ -574,10 +643,17 @@ complete list of changes, or look through the CVS logs for all the details.
On Windows, :func:`os.path.expandvars` will now expand environment variables
in the form "%var%", and "~user" will be expanded into the
user's home directory path. (Contributed by XXX.)
user's home directory path. (Contributed by Josiah Carlson.)
.. % Patch 957650
* The Python debugger provided by the :mod:`pdb` module
gained a new command: "run" restarts the Python program being debugged,
and can optionally take new command-line arguments for the program.
(Contributed by Rocky Bernstein.)
.. % Patch #1393667
* New functions in the :mod:`posix` module: :func:`chflags` and :func:`lchflags`
are wrappers for the corresponding system calls (where they're available).
Constants for the flag values are defined in the :mod:`stat` module; some
@ -701,6 +777,17 @@ complete list of changes, or look through the CVS logs for all the details.
(Added by Facundo Batista.)
* The XML-RPC classes :class:`SimpleXMLRPCServer` and :class:`DocXMLRPCServer`
classes can now be preventing from immediately opening and binding to
their socket by passing True as the ``bind_and_activate``
constructor parameter. This can be used to modify the instance's
:attr:`allow_reuse_address` attribute before calling the
:meth:`server_bind` and :meth:`server_activate` methods to
open the socket and begin listening for connections.
(Contributed by Peter Parente.)
.. % Patch 1599845
.. % ======================================================================
.. % whole new modules get described in \subsections here
@ -712,7 +799,7 @@ Build and C API Changes
Changes to Python's build process and to the C API include:
* Detailed changes are listed here.
* Detailed changes will be listed here.
.. % ======================================================================
@ -737,7 +824,7 @@ are likely to be underestimates.
Some of the more notable changes are:
* Details go here.
* Details will go here.
.. % ======================================================================