diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-18 09:56:22 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-18 09:56:22 (GMT) |
commit | 679db4aa99352abc3c9d93dcfc30e772760a43da (patch) | |
tree | a03e70818c211151cd9b9482d5f5563d93d9cd07 /Doc/whatsnew/2.6.rst | |
parent | ff72122184556afae962f32b7d7ac47bb2d5de33 (diff) | |
download | cpython-679db4aa99352abc3c9d93dcfc30e772760a43da.zip cpython-679db4aa99352abc3c9d93dcfc30e772760a43da.tar.gz cpython-679db4aa99352abc3c9d93dcfc30e772760a43da.tar.bz2 |
Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59987 | raymond.hettinger | 2008-01-15 21:52:42 +0100 (Tue, 15 Jan 2008) | 1 line
Refactor if/elif chain for clarity and speed. Remove dependency on subclasses having to implement _empty and _full.
........
r59988 | raymond.hettinger | 2008-01-15 22:22:47 +0100 (Tue, 15 Jan 2008) | 1 line
Fix-up half-written paragraph in the docs
........
r59989 | amaury.forgeotdarc | 2008-01-15 22:25:11 +0100 (Tue, 15 Jan 2008) | 3 lines
test_doctest fails since r59984.
Not sure if these are the correct values, but save_stdout has to be set before its usage...
........
r59992 | andrew.kuchling | 2008-01-16 01:32:03 +0100 (Wed, 16 Jan 2008) | 1 line
Docstring typos
........
r59993 | andrew.kuchling | 2008-01-16 04:17:25 +0100 (Wed, 16 Jan 2008) | 1 line
Add PEP 3141 section
........
r59998 | andrew.kuchling | 2008-01-16 14:01:51 +0100 (Wed, 16 Jan 2008) | 1 line
Markup fix
........
r59999 | georg.brandl | 2008-01-16 17:56:29 +0100 (Wed, 16 Jan 2008) | 2 lines
Fix MSDN library URL. (#1854)
........
r60006 | georg.brandl | 2008-01-16 21:27:56 +0100 (Wed, 16 Jan 2008) | 3 lines
Add Python-specific content to Doc dir. Update configuration file
to work with the newest Sphinx.
........
r60007 | georg.brandl | 2008-01-16 21:29:00 +0100 (Wed, 16 Jan 2008) | 2 lines
Doc build should work with 2.4 now.
........
r60009 | raymond.hettinger | 2008-01-17 00:38:16 +0100 (Thu, 17 Jan 2008) | 1 line
Minor wordsmithing.
........
r60010 | raymond.hettinger | 2008-01-17 00:40:45 +0100 (Thu, 17 Jan 2008) | 1 line
Add queues will alternative fetch orders (priority based and stack based).
........
r60011 | raymond.hettinger | 2008-01-17 00:49:35 +0100 (Thu, 17 Jan 2008) | 1 line
Add news entry.
........
r60013 | raymond.hettinger | 2008-01-17 04:02:14 +0100 (Thu, 17 Jan 2008) | 1 line
Make starmap() match its pure python definition and accept any itertable input (not just tuples).
........
r60015 | gregory.p.smith | 2008-01-17 08:43:20 +0100 (Thu, 17 Jan 2008) | 3 lines
Comply with RFC 3207.
Fixes issue 829951 - http://bugs.python.org/issue829951
........
r60018 | gregory.p.smith | 2008-01-17 09:03:17 +0100 (Thu, 17 Jan 2008) | 2 lines
entry for r60015
........
r60019 | raymond.hettinger | 2008-01-17 09:07:05 +0100 (Thu, 17 Jan 2008) | 1 line
Note versionadded.
........
r60020 | gregory.p.smith | 2008-01-17 09:35:49 +0100 (Thu, 17 Jan 2008) | 8 lines
Fixes (accepts patch) issue1339 - http://bugs.python.org/issue1339
- Factor out the duplication of EHLO/HELO in login() and sendmail() to
a new function, ehlo_or_helo_if_needed().
- Use ehlo_or_helo_if_needed() in starttls()
- Check for the starttls exception in starttls() in the same way as
login() checks for the auth extension.
Contributed by Bill Fenner.
........
r60021 | andrew.kuchling | 2008-01-17 13:00:15 +0100 (Thu, 17 Jan 2008) | 1 line
Revise 3141 section a bit; add some Windows items
........
r60022 | brett.cannon | 2008-01-17 19:45:10 +0100 (Thu, 17 Jan 2008) | 2 lines
Fix a function pointer declaration to silence the compiler.
........
r60024 | raymond.hettinger | 2008-01-17 20:31:38 +0100 (Thu, 17 Jan 2008) | 1 line
Issue #1861: Add read-only attribute listing upcoming events in the order they will be run.
........
r60025 | andrew.kuchling | 2008-01-17 20:49:24 +0100 (Thu, 17 Jan 2008) | 1 line
Correction from Jordan Lewis: halfdelay() uses tenths of a second, not milliseconds
........
r60026 | raymond.hettinger | 2008-01-17 23:27:49 +0100 (Thu, 17 Jan 2008) | 1 line
Add advice on choosing between scheduler and threading.Timer().
........
r60028 | christian.heimes | 2008-01-18 00:01:44 +0100 (Fri, 18 Jan 2008) | 2 lines
Updated new property syntax. An elaborate example for subclassing and the getter was missing.
Added comment about VS 2008 and PGO builds.
........
r60029 | raymond.hettinger | 2008-01-18 00:32:01 +0100 (Fri, 18 Jan 2008) | 1 line
Fix-up Timer() example.
........
r60030 | raymond.hettinger | 2008-01-18 00:56:56 +0100 (Fri, 18 Jan 2008) | 1 line
Fix markup
........
r60031 | raymond.hettinger | 2008-01-18 01:10:42 +0100 (Fri, 18 Jan 2008) | 1 line
clearcache() needs to remove the dict as well as clear it.
........
r60033 | andrew.kuchling | 2008-01-18 03:26:16 +0100 (Fri, 18 Jan 2008) | 1 line
Bump verson
........
r60034 | andrew.kuchling | 2008-01-18 03:42:52 +0100 (Fri, 18 Jan 2008) | 1 line
Typo fix
........
r60035 | christian.heimes | 2008-01-18 08:30:20 +0100 (Fri, 18 Jan 2008) | 3 lines
Coverity issue CID #197
var_decl: Declared variable "stm" without initializer
ninit_use_in_call: Using uninitialized value "stm" (field "stm".tm_zone uninitialized) in call to function "mktime"
........
r60036 | christian.heimes | 2008-01-18 08:45:30 +0100 (Fri, 18 Jan 2008) | 11 lines
Coverity issue CID #167
Event alloc_fn: Called allocation function "metacompile" [model]
Event var_assign: Assigned variable "gr" to storage returned from "metacompile"
gr = metacompile(n);
Event pass_arg: Variable "gr" not freed or pointed-to in function "maketables" [model]
g = maketables(gr);
translatelabels(g);
addfirstsets(g);
Event leaked_storage: Returned without freeing storage "gr"
return g;
........
r60038 | christian.heimes | 2008-01-18 09:04:57 +0100 (Fri, 18 Jan 2008) | 3 lines
Coverity issue CID #182
size_error: Allocating 1 bytes to pointer "children", which needs at least 4 bytes
........
r60041 | christian.heimes | 2008-01-18 09:47:59 +0100 (Fri, 18 Jan 2008) | 4 lines
Coverity issue CID #169
local_ptr_assign_local: Assigning address of stack variable "namebuf" to pointer "filename"
out_of_scope: Variable "namebuf" goes out of scope
use_invalid: Used "filename" pointing to out-of-scope variable "namebuf"
........
r60042 | christian.heimes | 2008-01-18 09:53:45 +0100 (Fri, 18 Jan 2008) | 2 lines
Coverity CID #168
leaked_storage: Returned without freeing storage "fp"
........
Diffstat (limited to 'Doc/whatsnew/2.6.rst')
-rw-r--r-- | Doc/whatsnew/2.6.rst | 124 |
1 files changed, 120 insertions, 4 deletions
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index 0539a44..46922a4 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -541,6 +541,90 @@ an abstract method. Implemented by XXX. Backported to 2.6 by Benjamin Aranguren, with Alex Martelli. +.. ====================================================================== + +.. _pep-3141: + +PEP 3141: A Type Hierarchy for Numbers +===================================================== + +In Python 3.0, several abstract base classes for numeric types, +inspired by Scheme's numeric tower, are being added. +This change was backported to 2.6 as the :mod:`numbers` module. + +The most general ABC is :class:`Number`. It defines no operations at +all, and only exists to allow checking if an object is a number by +doing ``isinstance(obj, Number)``. + +Numbers are further divided into :class:`Exact` and :class:`Inexact`. +Exact numbers can represent values precisely and operations never +round off the results or introduce tiny errors that may break the +communtativity and associativity properties; inexact numbers may +perform such rounding or introduce small errors. Integers, long +integers, and rational numbers are exact, while floating-point +and complex numbers are inexact. + +:class:`Complex` is a subclass of :class:`Number`. Complex numbers +can undergo the basic operations of addition, subtraction, +multiplication, division, and exponentiation, and you can retrieve the +real and imaginary parts and obtain a number's conjugate. Python's built-in +complex type is an implementation of :class:`Complex`. + +:class:`Real` further derives from :class:`Complex`, and adds +operations that only work on real numbers: :func:`floor`, :func:`trunc`, +rounding, taking the remainder mod N, floor division, +and comparisons. + +:class:`Rational` numbers derive from :class:`Real`, have +:attr:`numerator` and :attr:`denominator` properties, and can be +converted to floats. Python 2.6 adds a simple rational-number class +in the :mod:`rational` module. + +:class:`Integral` numbers derive from :class:`Rational`, and +can be shifted left and right with ``<<`` and ``>>``, +combined using bitwise operations such as ``&`` and ``|``, +and can be used as array indexes and slice boundaries. + +In Python 3.0, the PEP slightly redefines the existing built-ins +:func:`math.floor`, :func:`math.ceil`, :func:`round`, and adds a new +one, :func:`trunc`, that's been backported to Python 2.6. +:func:`trunc` rounds toward zero, returning the closest +:class:`Integral` that's between the function's argument and zero. + +.. seealso:: + + XXX link: Discusses Scheme's numeric tower. + + + +The Rational Module +-------------------------------------------------- + +To fill out the hierarchy of numeric types, a rational-number class +has been added as the :mod:`rational` module. Rational numbers are +represented as a fraction; rational numbers can exactly represent +numbers such as two-thirds that floating-point numbers can only +approximate. + +The :class:`Rational` constructor takes two :class:`Integral` values +that will be the numerator and denominator of the resulting fraction. :: + + >>> from rational import Rational + >>> a = Rational(2, 3) + >>> b = Rational(2, 5) + >>> float(a), float(b) + (0.66666666666666663, 0.40000000000000002) + >>> a+b + rational.Rational(16,15) + >>> a/b + rational.Rational(5,3) + +The :mod:`rational` module is based upon an implementation by Sjoerd +Mullender that was in Python's :file:`Demo/classes/` directory for a +long time. This implementation was significantly updated by Jeffrey +Yaskin. + + Other Language Changes ====================== @@ -568,10 +652,10 @@ Here are all of the changes that Python 2.6 makes to the core Python language. .. Revision 57619 -* Properties now have two attributes, +* Properties now have three attributes, :attr:`getter`, :attr:`setter` and :attr:`deleter`, that are useful shortcuts for - adding a setter or deleter function to an existing property. - You would use them like this:: + adding or modifying a getter, setter or deleter function to an + existing property. You would use them like this:: class C(object): @property @@ -586,6 +670,15 @@ Here are all of the changes that Python 2.6 makes to the core Python language. def x(self): del self._x + class D(C): + @C.x.getter + def x(self): + return self._x * 2 + + @x.setter + def x(self, value): + self._x = value / 2 + * C functions and methods that use :cfunc:`PyComplex_AsCComplex` will now accept arguments that @@ -997,6 +1090,12 @@ complete list of changes, or look through the CVS logs for all the details. .. Patch #957003 +* In the :mod:`smtplib` module, SMTP.starttls() now complies with :rfc:`3207` + and forgets any knowledge obtained from the server not obtained from + the TLS negotiation itself. Patch contributed by Bill Fenner. + + .. Issue 829951 + * 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. @@ -1246,13 +1345,30 @@ Port-Specific Changes: Windows API. The :func:`getwch` function reads a keypress and returns a Unicode value, as does the :func:`getwche` function. The :func:`putwch` function takes a Unicode character and writes it to the console. + (Contributed by Christian Heimes.) + +* :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 Josiah Carlson.) + +* The :mod:`socket` module's socket objects now have an + :meth:`ioctl` method that provides a limited interface to the + :cfunc:`WSAIoctl` system interface. * 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. + in :keyword:`with` statements. (Contributed by Christian Heimes.) + +* The new default compiler on Windows is Visual Studio 2008 (VS 9.0). The + build directories for Visual Studio 2003 (VS7.1) and 2005 (VS8.0) + were moved into the PC/ directory. The new PCbuild directory supports + cross compilation for X64, debug builds and Profile Guided Optimization + (PGO). PGO builds are roughly 10% faster than normal builds. + (Contributed by Christian Heimes with help from Amaury Forgeot d'Arc and + Martin von Loewis.) .. ====================================================================== |