summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-01-03 21:55:17 (GMT)
committerGeorg Brandl <georg@python.org>2009-01-03 21:55:17 (GMT)
commit734373cc4dfe81da12674b2f5a801ff14a5ebfe3 (patch)
tree353daaf1d6004adc26631a22ae31ca655eb966c0 /Doc/whatsnew
parent9b520efa8f4cebf9ecac41ccb529b9894c5cef95 (diff)
downloadcpython-734373cc4dfe81da12674b2f5a801ff14a5ebfe3.zip
cpython-734373cc4dfe81da12674b2f5a801ff14a5ebfe3.tar.gz
cpython-734373cc4dfe81da12674b2f5a801ff14a5ebfe3.tar.bz2
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r68133 | antoine.pitrou | 2009-01-01 16:38:03 +0100 (Thu, 01 Jan 2009) | 1 line fill in actual issue number in tests ........ r68134 | hirokazu.yamamoto | 2009-01-01 16:45:39 +0100 (Thu, 01 Jan 2009) | 2 lines Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open file with `str' filename on Windows. ........ r68141 | benjamin.peterson | 2009-01-01 17:43:12 +0100 (Thu, 01 Jan 2009) | 1 line fix highlighting ........ r68142 | benjamin.peterson | 2009-01-01 18:29:49 +0100 (Thu, 01 Jan 2009) | 2 lines welcome to 2009, Python! ........ r68145 | amaury.forgeotdarc | 2009-01-02 01:03:54 +0100 (Fri, 02 Jan 2009) | 5 lines #4801 _collections module fails to build on cygwin. _PyObject_GC_TRACK is the macro version of PyObject_GC_Track, and according to documentation it should not be used for extension modules. ........ r68146 | ronald.oussoren | 2009-01-02 11:44:46 +0100 (Fri, 02 Jan 2009) | 2 lines Fix for issue4472: "configure --enable-shared doesn't work on OSX" ........ r68148 | ronald.oussoren | 2009-01-02 11:48:31 +0100 (Fri, 02 Jan 2009) | 2 lines Forgot to add a NEWS item in my previous checkin ........ r68149 | ronald.oussoren | 2009-01-02 11:50:48 +0100 (Fri, 02 Jan 2009) | 2 lines Fix for issue4780 ........ r68159 | ronald.oussoren | 2009-01-02 15:48:17 +0100 (Fri, 02 Jan 2009) | 2 lines Fix for issue 1627952 ........ r68160 | ronald.oussoren | 2009-01-02 15:52:09 +0100 (Fri, 02 Jan 2009) | 2 lines Fix for issue r1737832 ........ r68161 | ronald.oussoren | 2009-01-02 16:00:05 +0100 (Fri, 02 Jan 2009) | 3 lines Fix for issue 1149804 ........ r68162 | ronald.oussoren | 2009-01-02 16:06:00 +0100 (Fri, 02 Jan 2009) | 3 lines Fix for issue 4472 is incompatible with Cygwin, this patch should fix that. ........ r68166 | benjamin.peterson | 2009-01-02 19:26:23 +0100 (Fri, 02 Jan 2009) | 1 line document PyMemberDef ........ r68171 | georg.brandl | 2009-01-02 21:25:14 +0100 (Fri, 02 Jan 2009) | 3 lines #4811: fix markup glitches (mostly remains of the conversion), found by Gabriel Genellina. ........ r68172 | martin.v.loewis | 2009-01-02 21:32:55 +0100 (Fri, 02 Jan 2009) | 2 lines Issue #4075: Use OutputDebugStringW in Py_FatalError. ........ r68173 | martin.v.loewis | 2009-01-02 21:40:14 +0100 (Fri, 02 Jan 2009) | 2 lines Issue #4051: Prevent conflict of UNICODE macros in cPickle. ........ r68174 | benjamin.peterson | 2009-01-02 21:47:27 +0100 (Fri, 02 Jan 2009) | 1 line fix compilation on non-Windows platforms ........ r68179 | raymond.hettinger | 2009-01-02 22:26:45 +0100 (Fri, 02 Jan 2009) | 1 line Issue #4615. Document how to use itertools for de-duping. ........ r68195 | georg.brandl | 2009-01-03 14:45:15 +0100 (Sat, 03 Jan 2009) | 2 lines Remove useless string literal. ........ r68196 | georg.brandl | 2009-01-03 15:29:53 +0100 (Sat, 03 Jan 2009) | 2 lines Fix indentation. ........ r68210 | georg.brandl | 2009-01-03 20:10:12 +0100 (Sat, 03 Jan 2009) | 2 lines Set eol-style correctly for mp_distributing.py. ........ r68214 | georg.brandl | 2009-01-03 20:44:48 +0100 (Sat, 03 Jan 2009) | 2 lines Make indentation consistent. ........ r68215 | georg.brandl | 2009-01-03 21:15:14 +0100 (Sat, 03 Jan 2009) | 2 lines Fix role name. ........ r68217 | georg.brandl | 2009-01-03 21:30:15 +0100 (Sat, 03 Jan 2009) | 2 lines Add rstlint, a little tool to find subtle markup problems and inconsistencies in the Doc sources. ........ r68218 | georg.brandl | 2009-01-03 21:38:59 +0100 (Sat, 03 Jan 2009) | 2 lines Recognize usage of the default role. ........ r68219 | georg.brandl | 2009-01-03 21:47:01 +0100 (Sat, 03 Jan 2009) | 2 lines Fix uses of the default role. ........ r68220 | georg.brandl | 2009-01-03 21:55:06 +0100 (Sat, 03 Jan 2009) | 2 lines Remove trailing whitespace. ........ r68221 | georg.brandl | 2009-01-03 22:04:55 +0100 (Sat, 03 Jan 2009) | 2 lines Remove tabs from the documentation. ........ r68222 | georg.brandl | 2009-01-03 22:11:58 +0100 (Sat, 03 Jan 2009) | 2 lines Disable the line length checker by default. ........
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/2.0.rst41
-rw-r--r--Doc/whatsnew/2.1.rst4
-rw-r--r--Doc/whatsnew/2.2.rst12
-rw-r--r--Doc/whatsnew/2.3.rst12
-rw-r--r--Doc/whatsnew/2.4.rst42
-rw-r--r--Doc/whatsnew/2.5.rst44
-rw-r--r--Doc/whatsnew/2.6.rst86
7 files changed, 120 insertions, 121 deletions
diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst
index 9ea5dc1..f5326d7 100644
--- a/Doc/whatsnew/2.0.rst
+++ b/Doc/whatsnew/2.0.rst
@@ -1,5 +1,5 @@
****************************
- What's New in Python 2.0
+ What's New in Python 2.0
****************************
:Author: A.M. Kuchling and Moshe Zadka
@@ -277,11 +277,11 @@ additional information. Take the first example in the previous paragraph,
finding all the strings in the list containing a given substring. You could
write the following to do it::
- # Given the list L, make a list of all strings
+ # Given the list L, make a list of all strings
# containing the substring S.
- sublist = filter( lambda s, substring=S:
+ sublist = filter( lambda s, substring=S:
string.find(s, substring) != -1,
- L)
+ L)
Because of Python's scoping rules, a default argument is used so that the
anonymous function created by the :keyword:`lambda` statement knows what
@@ -291,9 +291,9 @@ substring is being searched for. List comprehensions make this cleaner::
List comprehensions have the form::
- [ expression for expr in sequence1
+ [ expression for expr in sequence1
for expr2 in sequence2 ...
- for exprN in sequenceN
+ for exprN in sequenceN
if condition ]
The :keyword:`for`...\ :keyword:`in` clauses contain the sequences to be
@@ -312,8 +312,8 @@ following Python code::
...
for exprN in sequenceN:
if (condition):
- # Append the value of
- # the expression to the
+ # Append the value of
+ # the expression to the
# resulting list.
This means that when there are multiple :keyword:`for`...\ :keyword:`in`
@@ -368,7 +368,7 @@ instance with an incremented value.
def __init__(self, value):
self.value = value
def __iadd__(self, increment):
- return Number( self.value + increment)
+ return Number( self.value + increment)
n = Number(5)
n += 3
@@ -590,7 +590,7 @@ raised should still work. ::
def f():
print "i=",i
- i = i + 1
+ i = i + 1
f()
Two new exceptions, :exc:`TabError` and :exc:`IndentationError`, have been
@@ -627,7 +627,7 @@ would do, and also inserts it into the dictionary as the value for *key*. Thus,
the following lines of code::
if dict.has_key( key ): return dict[key]
- else:
+ else:
dict[key] = []
return dict[key]
@@ -836,14 +836,14 @@ the simple case, when the software contains only .py files, a minimal
:file:`setup.py` can be just a few lines long::
from distutils.core import setup
- setup (name = "foo", version = "1.0",
+ setup (name = "foo", version = "1.0",
py_modules = ["module1", "module2"])
The :file:`setup.py` file isn't much more complicated if the software consists
of a few packages::
from distutils.core import setup
- setup (name = "foo", version = "1.0",
+ setup (name = "foo", version = "1.0",
packages = ["package", "package.subpackage"])
A C extension can be the most complicated case; here's an example taken from
@@ -852,15 +852,14 @@ the PyXML package::
from distutils.core import setup, Extension
expat_extension = Extension('xml.parsers.pyexpat',
- define_macros = [('XML_NS', None)],
- include_dirs = [ 'extensions/expat/xmltok',
- 'extensions/expat/xmlparse' ],
- sources = [ 'extensions/pyexpat.c',
- 'extensions/expat/xmltok/xmltok.c',
- 'extensions/expat/xmltok/xmlrole.c',
- ]
+ define_macros = [('XML_NS', None)],
+ include_dirs = [ 'extensions/expat/xmltok',
+ 'extensions/expat/xmlparse' ],
+ sources = [ 'extensions/pyexpat.c',
+ 'extensions/expat/xmltok/xmltok.c',
+ 'extensions/expat/xmltok/xmlrole.c', ]
)
- setup (name = "PyXML", version = "0.5.4",
+ setup (name = "PyXML", version = "0.5.4",
ext_modules =[ expat_extension ] )
The Distutils can also take care of creating source and binary distributions.
diff --git a/Doc/whatsnew/2.1.rst b/Doc/whatsnew/2.1.rst
index c3f1280..6b2ce3f 100644
--- a/Doc/whatsnew/2.1.rst
+++ b/Doc/whatsnew/2.1.rst
@@ -1,5 +1,5 @@
****************************
- What's New in Python 2.1
+ What's New in Python 2.1
****************************
:Author: A.M. Kuchling
@@ -98,7 +98,7 @@ To make the preceding explanation a bit clearer, here's an example::
x = 1
def f():
# The next line is a syntax error
- exec 'x=2'
+ exec 'x=2'
def g():
return x
diff --git a/Doc/whatsnew/2.2.rst b/Doc/whatsnew/2.2.rst
index 1383298..ec435f7 100644
--- a/Doc/whatsnew/2.2.rst
+++ b/Doc/whatsnew/2.2.rst
@@ -1,5 +1,5 @@
****************************
- What's New in Python 2.2
+ What's New in Python 2.2
****************************
:Author: A.M. Kuchling
@@ -295,7 +295,7 @@ will be used in methods to call a method in the superclass; for example,
class D (B,C):
def save (self):
- # Call superclass .save()
+ # Call superclass .save()
super(D, self).save()
# Save D's private information here
...
@@ -473,7 +473,7 @@ there are no more values to be returned, calling :meth:`next` should raise the
Traceback (most recent call last):
File "<stdin>", line 1, in ?
StopIteration
- >>>
+ >>>
In 2.2, Python's :keyword:`for` statement no longer expects a sequence; it
expects something for which :func:`iter` will return an iterator. For backward
@@ -909,7 +909,7 @@ To make the preceding explanation a bit clearer, here's an example::
x = 1
def f():
# The next line is a syntax error
- exec 'x=2'
+ exec 'x=2'
def g():
return x
@@ -952,8 +952,8 @@ New and Improved Modules
items = s.meerkat.getItems( {'channel': 4} )
# 'items' is another list of dictionaries, like this:
- # [{'link': 'http://freshmeat.net/releases/52719/',
- # 'description': 'A utility which converts HTML to XSL FO.',
+ # [{'link': 'http://freshmeat.net/releases/52719/',
+ # 'description': 'A utility which converts HTML to XSL FO.',
# 'title': 'html2fo 0.3 (Default)'}, ... ]
The :mod:`SimpleXMLRPCServer` module makes it easy to create straightforward
diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst
index da4f24f..eeb471a 100644
--- a/Doc/whatsnew/2.3.rst
+++ b/Doc/whatsnew/2.3.rst
@@ -1,5 +1,5 @@
****************************
- What's New in Python 2.3
+ What's New in Python 2.3
****************************
:Author: A.M. Kuchling
@@ -301,7 +301,7 @@ For example::
-------- -------
8467 1 file
amk@nyman:~/src/python$ ./python
- Python 2.3 (#1, Aug 1 2003, 19:54:32)
+ Python 2.3 (#1, Aug 1 2003, 19:54:32)
>>> import sys
>>> sys.path.insert(0, '/tmp/example.zip') # Add .zip file to front of path
>>> import jwzthreading
@@ -671,7 +671,7 @@ with older versions of the Distutils::
# ...
}
- if (hasattr(core, 'setup_keywords') and
+ if (hasattr(core, 'setup_keywords') and
'classifiers' in core.setup_keywords):
kw['classifiers'] = \
['Topic :: Internet :: WWW/HTTP :: Dynamic Content',
@@ -1027,7 +1027,7 @@ Here are all of the changes that Python 2.3 makes to the core Python language.
creating small dictionaries::
>>> dict(red=1, blue=2, green=3, black=4)
- {'blue': 2, 'black': 4, 'green': 3, 'red': 1}
+ {'blue': 2, 'black': 4, 'green': 3, 'red': 1}
(Contributed by Just van Rossum.)
@@ -1622,7 +1622,7 @@ complete list of changes, or look through the CVS logs for all the details.
... self.valuelist.pop(i)
... def keys(self):
... return list(self.keylist)
- ...
+ ...
>>> s = SeqDict()
>>> dir(s) # See that other dictionary methods are implemented
['__cmp__', '__contains__', '__delitem__', '__doc__', '__getitem__',
@@ -1779,7 +1779,7 @@ The help message is automatically generated for you::
set input filename
-lLENGTH, --length=LENGTH
set maximum length of output
- $
+ $
See the module's documentation for more details.
diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst
index 59788ba..9e438ac 100644
--- a/Doc/whatsnew/2.4.rst
+++ b/Doc/whatsnew/2.4.rst
@@ -1,5 +1,5 @@
****************************
- What's New in Python 2.4
+ What's New in Python 2.4
****************************
:Author: A.M. Kuchling
@@ -63,10 +63,10 @@ symmetric differences. ::
>>> a.add('z') # add a new element
>>> a.update('wxy') # add multiple new elements
>>> a
- set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'x', 'z'])
+ set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'x', 'z'])
>>> a.remove('x') # take one element out
>>> a
- set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z'])
+ set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z'])
The :func:`frozenset` type is an immutable version of :func:`set`. Since it is
immutable and hashable, it may be used as a dictionary key or as a member of
@@ -351,7 +351,7 @@ iterator that loops over the elements of the sequence in reverse order. ::
>>> for i in reversed(xrange(1,4)):
... print i
- ...
+ ...
3
2
1
@@ -366,7 +366,7 @@ you want to reverse an iterator, first convert it to a list with :func:`list`.
>>> input = open('/etc/passwd', 'r')
>>> for line in reversed(list(input)):
... print line
- ...
+ ...
root:*:0:0:System Administrator:/var/root:/bin/tcsh
...
@@ -396,10 +396,10 @@ single class called :class:`Popen` whose constructor supports a number of
different keyword arguments. ::
class Popen(args, bufsize=0, executable=None,
- stdin=None, stdout=None, stderr=None,
- preexec_fn=None, close_fds=False, shell=False,
- cwd=None, env=None, universal_newlines=False,
- startupinfo=None, creationflags=0):
+ stdin=None, stdout=None, stderr=None,
+ preexec_fn=None, close_fds=False, shell=False,
+ cwd=None, env=None, universal_newlines=False,
+ startupinfo=None, creationflags=0):
*args* is commonly a sequence of strings that will be the arguments to the
program executed as the subprocess. (If the *shell* argument is true, *args*
@@ -650,7 +650,7 @@ the precision of the default context::
28
>>> decimal.Decimal(1) / decimal.Decimal(7)
Decimal("0.1428571428571428571428571429")
- >>> decimal.getcontext().prec = 9
+ >>> decimal.getcontext().prec = 9
>>> decimal.Decimal(1) / decimal.Decimal(7)
Decimal("0.142857143")
@@ -665,7 +665,7 @@ raised::
>>> decimal.getcontext().traps[decimal.DivisionByZero] = False
>>> decimal.Decimal(1) / decimal.Decimal(0)
Decimal("Infinity")
- >>>
+ >>>
The :class:`Context` instance also has various methods for formatting numbers
such as :meth:`to_eng_string` and :meth:`to_sci_string`.
@@ -803,7 +803,7 @@ Here are all of the changes that Python 2.4 makes to the core Python language.
>>> 'www.python.org'.split('.', 1)
['www', 'python.org']
'www.python.org'.rsplit('.', 1)
- ['www.python', 'org']
+ ['www.python', 'org']
* Three keyword parameters, *cmp*, *key*, and *reverse*, were added to the
:meth:`sort` method of lists. These parameters make some common usages of
@@ -1045,7 +1045,7 @@ complete list of changes, or look through the CVS logs for all the details.
>>> list(d) # list the contents of the deque
['g', 'h', 'i']
>>> 'h' in d # search the deque
- True
+ True
Several modules, such as the :mod:`Queue` and :mod:`threading` modules, now take
advantage of :class:`collections.deque` for improved performance. (Contributed
@@ -1106,13 +1106,13 @@ complete list of changes, or look through the CVS logs for all the details.
>>> L = [2, 4, 6, 7, 8, 9, 11, 12, 14]
>>> for key_val, it in itertools.groupby(L, lambda x: x % 2):
... print key_val, list(it)
- ...
+ ...
0 [2, 4, 6]
1 [7]
0 [8]
1 [9, 11]
0 [12, 14]
- >>>
+ >>>
:func:`groupby` is typically used with sorted input. The logic for
:func:`groupby` is similar to the Unix ``uniq`` filter which makes it handy for
@@ -1120,21 +1120,21 @@ complete list of changes, or look through the CVS logs for all the details.
>>> word = 'abracadabra'
>>> letters = sorted(word) # Turn string into a sorted list of letters
- >>> letters
+ >>> letters
['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r']
>>> for k, g in itertools.groupby(letters):
... print k, list(g)
- ...
+ ...
a ['a', 'a', 'a', 'a', 'a']
b ['b', 'b']
c ['c']
d ['d']
r ['r', 'r']
>>> # List unique letters
- >>> [k for k, g in groupby(letters)]
+ >>> [k for k, g in groupby(letters)]
['a', 'b', 'c', 'd', 'r']
>>> # Count letter occurrences
- >>> [(k, len(list(g))) for k, g in groupby(letters)]
+ >>> [(k, len(list(g))) for k, g in groupby(letters)]
[('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)]
(Contributed by Hye-Shik Chang.)
@@ -1175,7 +1175,7 @@ complete list of changes, or look through the CVS logs for all the details.
import logging
logging.basicConfig(filename='/var/log/application.log',
level=0, # Log all messages
- format='%(levelname):%(process):%(thread):%(message)')
+ format='%(levelname):%(process):%(thread):%(message)')
Other additions to the :mod:`logging` package include a :meth:`log(level, msg)`
convenience method, as well as a :class:`TimedRotatingFileHandler` class that
@@ -1428,7 +1428,7 @@ Running the above function's tests with :const:`doctest.REPORT_UDIFF` specified,
you get the following output::
**********************************************************************
- File ``t.py'', line 15, in g
+ File "t.py", line 15, in g
Failed example:
g(4)
Differences (unified diff with -expected +actual):
diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst
index 43ba6e5..e1e2887 100644
--- a/Doc/whatsnew/2.5.rst
+++ b/Doc/whatsnew/2.5.rst
@@ -1,5 +1,5 @@
****************************
- What's New in Python 2.5
+ What's New in Python 2.5
****************************
:Author: A.M. Kuchling
@@ -220,7 +220,7 @@ in the package index, determine the dependencies for a package, and download the
required packages. ::
VERSION = '1.0'
- setup(name='PyPackage',
+ setup(name='PyPackage',
version=VERSION,
requires=['numarray', 'zlib (>=1.1.4)'],
obsoletes=['OldPackage']
@@ -388,7 +388,7 @@ write::
else:
else-block
finally:
- final-block
+ final-block
The code in *block-1* is executed. If the code raises an exception, the various
:keyword:`except` blocks are tested: if the exception is of class
@@ -485,7 +485,7 @@ And here's an example of changing the counter::
9
>>> print it.next()
Traceback (most recent call last):
- File ``t.py'', line 15, in ?
+ File "t.py", line 15, in ?
print it.next()
StopIteration
@@ -835,8 +835,8 @@ catch all exceptions, so you commonly need to list :exc:`KeyboardInterrupt` and
...
except (KeyboardInterrupt, SystemExit):
raise
- except:
- # Log error...
+ except:
+ # Log error...
# Continue running program...
In Python 2.5, you can now write ``except Exception`` to achieve the same
@@ -947,7 +947,7 @@ arguments and returns an integer giving the slice index to use. For example::
class C:
def __index__ (self):
- return self.value
+ return self.value
The return value must be either a Python integer or long integer. The
interpreter will check that the type returned is correct, and raises a
@@ -1035,9 +1035,9 @@ Here are all of the changes that Python 2.5 makes to the core Python language.
L = ['medium', 'longest', 'short']
# Prints 'longest'
- print max(L, key=len)
+ print max(L, key=len)
# Prints 'short', because lexicographically 'short' has the largest value
- print max(L)
+ print max(L)
(Contributed by Steven Bethard and Raymond Hettinger.)
@@ -1070,8 +1070,8 @@ Here are all of the changes that Python 2.5 makes to the core Python language.
using the default ASCII encoding. The result of the comparison is false::
>>> chr(128) == unichr(128) # Can't convert chr(128) to Unicode
- __main__:1: UnicodeWarning: Unicode equal comparison failed
- to convert both arguments to Unicode - interpreting them
+ __main__:1: UnicodeWarning: Unicode equal comparison failed
+ to convert both arguments to Unicode - interpreting them
as being unequal
False
>>> chr(127) == unichr(127) # chr(127) can be converted
@@ -1259,10 +1259,10 @@ complete list of changes, or look through the SVN logs for all the details.
Printing ``index`` results in the following output::
- defaultdict(<type 'list'>, {'c': ['cammin', 'che'], 'e': ['era'],
- 'd': ['del', 'di', 'diritta'], 'm': ['mezzo', 'mi'],
- 'l': ['la'], 'o': ['oscura'], 'n': ['nel', 'nostra'],
- 'p': ['per'], 's': ['selva', 'smarrita'],
+ defaultdict(<type 'list'>, {'c': ['cammin', 'che'], 'e': ['era'],
+ 'd': ['del', 'di', 'diritta'], 'm': ['mezzo', 'mi'],
+ 'l': ['la'], 'o': ['oscura'], 'n': ['nel', 'nostra'],
+ 'p': ['per'], 's': ['selva', 'smarrita'],
'r': ['ritrovai'], 'u': ['una'], 'v': ['vita', 'via']}
(Contributed by Guido van Rossum.)
@@ -1884,17 +1884,17 @@ is that the constructor functions for creating new hashing objects are named
differently. ::
# Old versions
- h = md5.md5()
- h = md5.new()
+ h = md5.md5()
+ h = md5.new()
- # New version
+ # New version
h = hashlib.md5()
# Old versions
- h = sha.sha()
- h = sha.new()
+ h = sha.sha()
+ h = sha.new()
- # New version
+ # New version
h = hashlib.sha1()
# Hash that weren't previously available
@@ -2191,7 +2191,7 @@ Changes to Python's build process and to the C API include:
case that your extensions were using it, you can replace it by something like
the following::
- range = PyObject_CallFunction((PyObject*) &PyRange_Type, "lll",
+ range = PyObject_CallFunction((PyObject*) &PyRange_Type, "lll",
start, stop, step);
.. ======================================================================
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 6d0d422..457bef2 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -586,30 +586,30 @@ multiple of 4.
def factorial(queue, N):
- "Compute a factorial."
- # If N is a multiple of 4, this function will take much longer.
- if (N % 4) == 0:
- time.sleep(.05 * N/4)
+ "Compute a factorial."
+ # If N is a multiple of 4, this function will take much longer.
+ if (N % 4) == 0:
+ time.sleep(.05 * N/4)
- # Calculate the result
- fact = 1L
- for i in range(1, N+1):
- fact = fact * i
+ # Calculate the result
+ fact = 1L
+ for i in range(1, N+1):
+ fact = fact * i
- # Put the result on the queue
- queue.put(fact)
+ # Put the result on the queue
+ queue.put(fact)
if __name__ == '__main__':
- queue = Queue()
+ queue = Queue()
- N = 5
+ N = 5
- p = Process(target=factorial, args=(queue, N))
- p.start()
- p.join()
+ p = Process(target=factorial, args=(queue, N))
+ p.start()
+ p.join()
- result = queue.get()
- print 'Factorial', N, '=', result
+ result = queue.get()
+ print 'Factorial', N, '=', result
A :class:`Queue` is used to communicate the input parameter *N* and
the result. The :class:`Queue` object is stored in a global variable.
@@ -630,12 +630,12 @@ across 5 worker processes and retrieve a list of results::
from multiprocessing import Pool
def factorial(N, dictionary):
- "Compute a factorial."
- ...
+ "Compute a factorial."
+ ...
p = Pool(5)
result = p.map(factorial, range(1, 1000, 10))
for v in result:
- print v
+ print v
This produces the following output::
@@ -744,7 +744,7 @@ supply compound field names that read attributes or access dictionary keys::
>>> import sys
>>> print 'Platform: {0.platform}\nPython version: {0.version}'.format(sys)
Platform: darwin
- Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)
+ Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'
>>> import mimetypes
@@ -958,8 +958,8 @@ representing ``ABC``; in 2.6, ``bytes([65, 66, 67])`` returns the
The primary use of :class:`bytes` in 2.6 will be to write tests of
object type such as ``isinstance(x, bytes)``. This will help the 2to3
converter, which can't tell whether 2.x code intends strings to
-contain either characters or 8-bit bytes; you can now
-use either :class:`bytes` or :class:`str` to represent your intention
+contain either characters or 8-bit bytes; you can now
+use either :class:`bytes` or :class:`str` to represent your intention
exactly, and the resulting code will also be correct in Python 3.0.
There's also a ``__future__`` import that causes all string literals
@@ -1834,9 +1834,9 @@ changes, or look through the Subversion logs for all the details.
"/cgi-bin/add.py?category=1". (Contributed by Alexandre Fiori and
Nubis; :issue:`1817`.)
- The :func:`parse_qs` and :func:`parse_qsl` functions have been
+ The :func:`parse_qs` and :func:`parse_qsl` functions have been
relocated from the :mod:`cgi` module to the :mod:`urlparse` module.
- The versions still available in the :mod:`cgi` module will
+ The versions still available in the :mod:`cgi` module will
trigger :exc:`PendingDeprecationWarning` messages in 2.6
(:issue:`600362`).
@@ -1885,9 +1885,9 @@ changes, or look through the Subversion logs for all the details.
('id', 'name', 'type', 'size')
>>> var = var_type(1, 'frequency', 'int', 4)
- >>> print var[0], var.id # Equivalent
+ >>> print var[0], var.id # Equivalent
1 1
- >>> print var[2], var.type # Equivalent
+ >>> print var[2], var.type # Equivalent
int int
>>> var._asdict()
{'size': 4, 'type': 'int', 'id': 1, 'name': 'frequency'}
@@ -1931,7 +1931,7 @@ changes, or look through the Subversion logs for all the details.
* A new window method in the :mod:`curses` module,
:meth:`chgat`, changes the display attributes for a certain number of
characters on a single line. (Contributed by Fabian Kreutz.)
-
+
::
# Boldface text starting at y=0,x=21
@@ -2046,8 +2046,8 @@ changes, or look through the Subversion logs for all the details.
>>> list(itertools.product([1,2,3], [4,5,6]))
[(1, 4), (1, 5), (1, 6),
- (2, 4), (2, 5), (2, 6),
- (3, 4), (3, 5), (3, 6)]
+ (2, 4), (2, 5), (2, 6),
+ (3, 4), (3, 5), (3, 6)]
The optional *repeat* keyword argument is used for taking the
product of an iterable or a set of iterables with themselves,
@@ -2428,9 +2428,9 @@ changes, or look through the Subversion logs for all the details.
:issue:`742598`, :issue:`1193577`.)
* The :mod:`sqlite3` module, maintained by Gerhard Haering,
- has been updated from version 2.3.2 in Python 2.5 to
+ has been updated from version 2.3.2 in Python 2.5 to
version 2.4.1.
-
+
* The :mod:`struct` module now supports the C99 :ctype:`_Bool` type,
using the format character ``'?'``.
(Contributed by David Remahl.)
@@ -2525,9 +2525,9 @@ changes, or look through the Subversion logs for all the details.
``with tempfile.NamedTemporaryFile() as tmp: ...``.
(Contributed by Alexander Belopolsky; :issue:`2021`.)
-* The :mod:`test.test_support` module gained a number
- of context managers useful for writing tests.
- :func:`EnvironmentVarGuard` is a
+* The :mod:`test.test_support` module gained a number
+ of context managers useful for writing tests.
+ :func:`EnvironmentVarGuard` is a
context manager that temporarily changes environment variables and
automatically restores them to their old values.
@@ -2542,7 +2542,7 @@ changes, or look through the Subversion logs for all the details.
f = urllib.urlopen('https://sf.net')
...
- Finally, :func:`check_warnings` resets the :mod:`warning` module's
+ Finally, :func:`check_warnings` resets the :mod:`warning` module's
warning filters and returns an object that will record all warning
messages triggered (:issue:`3781`)::
@@ -2582,7 +2582,7 @@ changes, or look through the Subversion logs for all the details.
:meth:`activeCount` method is renamed to :meth:`active_count`. Both
the 2.6 and 3.0 versions of the module support the same properties
and renamed methods, but don't remove the old methods. No date has been set
- for the deprecation of the old APIs in Python 3.x; the old APIs won't
+ for the deprecation of the old APIs in Python 3.x; the old APIs won't
be removed in any 2.x version.
(Carried out by several people, most notably Benjamin Peterson.)
@@ -2639,7 +2639,7 @@ changes, or look through the Subversion logs for all the details.
(Added by Facundo Batista.)
* The Unicode database provided by the :mod:`unicodedata` module
- has been updated to version 5.1.0. (Updated by
+ has been updated to version 5.1.0. (Updated by
Martin von Loewis; :issue:`3811`.)
* The :mod:`warnings` module's :func:`formatwarning` and :func:`showwarning`
@@ -2650,7 +2650,7 @@ changes, or look through the Subversion logs for all the details.
A new function, :func:`catch_warnings`, is a context manager
intended for testing purposes that lets you temporarily modify the
warning filters and then restore their original values (:issue:`3781`).
-
+
* The XML-RPC :class:`SimpleXMLRPCServer` and :class:`DocXMLRPCServer`
classes can now be prevented from immediately opening and binding to
their socket by passing True as the ``bind_and_activate``
@@ -3220,8 +3220,8 @@ that may require changes to your code:
* :meth:`object.__init__` previously accepted arbitrary arguments and
keyword arguments, ignoring them. In Python 2.6, this is no longer
- allowed and will result in a :exc:`TypeError`. This will affect
- :meth:`__init__` methods that end up calling the corresponding
+ allowed and will result in a :exc:`TypeError`. This will affect
+ :meth:`__init__` methods that end up calling the corresponding
method on :class:`object` (perhaps through using :func:`super`).
See :issue:`1683368` for discussion.
@@ -3281,7 +3281,7 @@ Acknowledgements
The author would like to thank the following people for offering
suggestions, corrections and assistance with various drafts of this
-article: Georg Brandl, Steve Brown, Nick Coghlan, Ralph Corderoy,
-Jim Jewett, Kent Johnson, Chris Lambacher, Martin Michlmayr,
+article: Georg Brandl, Steve Brown, Nick Coghlan, Ralph Corderoy,
+Jim Jewett, Kent Johnson, Chris Lambacher, Martin Michlmayr,
Antoine Pitrou, Brian Warner.