diff options
author | Christian Heimes <christian@cheimes.de> | 2007-12-17 20:04:13 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2007-12-17 20:04:13 (GMT) |
commit | 2c1816160639f00489aa8bac6178e44bb51e7adb (patch) | |
tree | 2b0cf29416e1b6bacef23bf4c1736a464f864c19 /Doc/whatsnew | |
parent | 3377055486af6021e7662fc53f1504bd26981ea6 (diff) | |
download | cpython-2c1816160639f00489aa8bac6178e44bb51e7adb.zip cpython-2c1816160639f00489aa8bac6178e44bb51e7adb.tar.gz cpython-2c1816160639f00489aa8bac6178e44bb51e7adb.tar.bz2 |
Merged revisions 59512-59540 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59513 | raymond.hettinger | 2007-12-15 01:07:25 +0100 (Sat, 15 Dec 2007) | 6 lines
Optimize PyList_AsTuple(). Improve cache performance by doing the
pointer copy and object increment in one pass. For small lists,
save the overhead of the call to memcpy() -- this comes up in
calls like f(*listcomp).
........
r59519 | christian.heimes | 2007-12-15 06:38:35 +0100 (Sat, 15 Dec 2007) | 2 lines
Fixed #1624: Remove output comparison for test_pep277
I had to modify Brett's patch slightly.
........
r59520 | georg.brandl | 2007-12-15 10:34:59 +0100 (Sat, 15 Dec 2007) | 2 lines
Add note about future import needed for with statement.
........
r59522 | georg.brandl | 2007-12-15 10:36:37 +0100 (Sat, 15 Dec 2007) | 2 lines
Argh, wrong version.
........
r59524 | georg.brandl | 2007-12-16 12:06:09 +0100 (Sun, 16 Dec 2007) | 2 lines
Dummy commit to investigate #1617.
........
r59525 | georg.brandl | 2007-12-16 12:21:48 +0100 (Sun, 16 Dec 2007) | 2 lines
Revert dummy commit now that the build slave is building.
........
r59527 | georg.brandl | 2007-12-16 16:47:46 +0100 (Sun, 16 Dec 2007) | 2 lines
Remove orphaned footnote reference.
........
r59528 | georg.brandl | 2007-12-16 16:53:49 +0100 (Sun, 16 Dec 2007) | 2 lines
Remove gratuitous unicode character.
........
r59529 | georg.brandl | 2007-12-16 16:59:19 +0100 (Sun, 16 Dec 2007) | 2 lines
Remove another unnecessary Unicode character.
........
r59530 | georg.brandl | 2007-12-16 17:00:36 +0100 (Sun, 16 Dec 2007) | 2 lines
Remove curious space-like characters.
........
r59532 | georg.brandl | 2007-12-16 20:36:51 +0100 (Sun, 16 Dec 2007) | 2 lines
Adapt conf.py to new option names.
........
r59533 | christian.heimes | 2007-12-16 22:39:43 +0100 (Sun, 16 Dec 2007) | 1 line
Fixed #1638: %zd configure test fails on Linux
........
r59536 | georg.brandl | 2007-12-17 00:11:16 +0100 (Mon, 17 Dec 2007) | 2 lines
Simplify.
........
r59537 | georg.brandl | 2007-12-17 00:13:29 +0100 (Mon, 17 Dec 2007) | 2 lines
Use PEP 8.
........
r59539 | georg.brandl | 2007-12-17 00:15:07 +0100 (Mon, 17 Dec 2007) | 2 lines
Don't use quotes for non-string code.
........
r59540 | facundo.batista | 2007-12-17 15:18:42 +0100 (Mon, 17 Dec 2007) | 4 lines
Removed the private _rounding_decision: it was not needed, and the code
is now simpler. Thanks Mark Dickinson.
........
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/2.6.rst | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index c63cc32..f21ff72 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -202,7 +202,7 @@ A high-level explanation of the context management protocol is: methods. * The context manager's :meth:`__enter__` method is called. The value returned - is assigned to *VAR*. If no ``'as VAR'`` clause is present, the value is simply + is assigned to *VAR*. If no ``as VAR`` clause is present, the value is simply discarded. * The code in *BLOCK* is executed. @@ -242,11 +242,11 @@ rolled back if there's an exception. Here's the basic interface for class DatabaseConnection: # Database interface - def cursor (self): + def cursor(self): "Returns a cursor object and starts a new transaction" - def commit (self): + def commit(self): "Commits current transaction" - def rollback (self): + def rollback(self): "Rolls back current transaction" The :meth:`__enter__` method is pretty easy, having only to start a new @@ -256,7 +256,7 @@ their ':keyword:`with`' statement to bind the cursor to a variable name. :: class DatabaseConnection: ... - def __enter__ (self): + def __enter__(self): # Code to start a new transaction cursor = self.cursor() return cursor @@ -273,7 +273,7 @@ add a :keyword:`return` statement at the marked location. :: class DatabaseConnection: ... - def __exit__ (self, type, value, tb): + def __exit__(self, type, value, tb): if tb is None: # No exception, so commit self.commit() @@ -306,7 +306,7 @@ decorator as:: from contextlib import contextmanager @contextmanager - def db_transaction (connection): + def db_transaction(connection): cursor = connection.cursor() try: yield cursor |