summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-01-03 21:26:05 (GMT)
committerGeorg Brandl <georg@python.org>2009-01-03 21:26:05 (GMT)
commita1c6a1cea5af1d3c7682a8e99b001b0904480e4d (patch)
tree85461d1ba5237440b36f253b197779190226a294 /Doc/whatsnew
parent48310cd3f2e02ced9ae836ccbcb67e9af3097d62 (diff)
downloadcpython-a1c6a1cea5af1d3c7682a8e99b001b0904480e4d.zip
cpython-a1c6a1cea5af1d3c7682a8e99b001b0904480e4d.tar.gz
cpython-a1c6a1cea5af1d3c7682a8e99b001b0904480e4d.tar.bz2
Merged revisions 68221 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r68221 | georg.brandl | 2009-01-03 22:04:55 +0100 (Sat, 03 Jan 2009) | 2 lines Remove tabs from the documentation. ........
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/2.0.rst19
-rw-r--r--Doc/whatsnew/2.2.rst2
-rw-r--r--Doc/whatsnew/2.4.rst8
-rw-r--r--Doc/whatsnew/2.6.rst48
4 files changed, 38 insertions, 39 deletions
diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst
index 75205d4..f5326d7 100644
--- a/Doc/whatsnew/2.0.rst
+++ b/Doc/whatsnew/2.0.rst
@@ -281,7 +281,7 @@ write the following to do it::
# containing the 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
@@ -293,7 +293,7 @@ List comprehensions have the form::
[ 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
@@ -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
@@ -852,13 +852,12 @@ 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",
ext_modules =[ expat_extension ] )
diff --git a/Doc/whatsnew/2.2.rst b/Doc/whatsnew/2.2.rst
index 28ecb81..ec435f7 100644
--- a/Doc/whatsnew/2.2.rst
+++ b/Doc/whatsnew/2.2.rst
@@ -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
...
diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst
index d608c2b..4ce8132 100644
--- a/Doc/whatsnew/2.4.rst
+++ b/Doc/whatsnew/2.4.rst
@@ -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*
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 750f7db..5ee71f4 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -590,30 +590,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.
@@ -634,12 +634,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::
@@ -1889,9 +1889,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'}
@@ -2050,8 +2050,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,