]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add docstring to dbm.open
authorÉric Araujo <merwok@netwok.org>
Wed, 20 Apr 2011 16:52:55 +0000 (18:52 +0200)
committerÉric Araujo <merwok@netwok.org>
Wed, 20 Apr 2011 16:52:55 +0000 (18:52 +0200)
Lib/dbm/__init__.py

index 99c16379a957e9b701232c06543a0cd78c7902ac..57be17b40818ab103097fbd1c05e80c95e2bf178 100644 (file)
@@ -24,16 +24,8 @@ It has the following interface (key and data are strings):
         list = d.keys() # return a list of all existing keys (slow!)
 
 Future versions may change the order in which implementations are
-tested for existence, add interfaces to other dbm-like
+tested for existence, and add interfaces to other dbm-like
 implementations.
-
-The open function has an optional second argument.  This can be 'r',
-for read-only access, 'w', for read-write access of an existing
-database, 'c' for read-write access to a new or existing database, and
-'n' for read-write access to a new database.  The default is 'r'.
-
-Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it
-only if it doesn't exist; and 'n' always creates a new database.
 """
 
 __all__ = ['open', 'whichdb', 'error', 'error']
@@ -54,7 +46,17 @@ _modules = {}
 error = (error, IOError)
 
 
-def open(file, flag = 'r', mode = 0o666):
+def open(file, flag='r', mode=0o666):
+    """Open or create database at path given by *file*.
+
+    Optional argument *flag* can be 'r' (default) for read-only access, 'w'
+    for read-write access of an existing database, 'c' for read-write access
+    to a new or existing database, and 'n' for read-write access to a new
+    database.
+
+    Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it
+    only if it doesn't exist; and 'n' always creates a new database.
+    """
     global _defaultmod
     if _defaultmod is None:
         for name in _names: