diff options
author | Georg Brandl <georg@python.org> | 2007-12-16 23:13:29 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-12-16 23:13:29 (GMT) |
commit | 9f72d237f856dc98a73815e105b3a6003afadd0a (patch) | |
tree | 86cba34561816487730a38c388375597ab618884 /Doc/whatsnew | |
parent | 001e8388d46b8a0da3b75ddb4acd66076ba7627e (diff) | |
download | cpython-9f72d237f856dc98a73815e105b3a6003afadd0a.zip cpython-9f72d237f856dc98a73815e105b3a6003afadd0a.tar.gz cpython-9f72d237f856dc98a73815e105b3a6003afadd0a.tar.bz2 |
Use PEP 8.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/2.6.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index eb2e17c..d56a1ff 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -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 |