[Python-checkins] cpython (3.1): Add docstring to dbm.open

eric.araujo python-checkins at python.org
Wed Apr 27 16:37:48 CEST 2011


http://hg.python.org/cpython/rev/7601c8256a3d
changeset:   69601:7601c8256a3d
branch:      3.1
user:        Éric Araujo <merwok at netwok.org>
date:        Wed Apr 20 18:52:55 2011 +0200
summary:
  Add docstring to dbm.open

files:
  Lib/dbm/__init__.py |  22 ++++++++++++----------
  1 files changed, 12 insertions(+), 10 deletions(-)


diff --git a/Lib/dbm/__init__.py b/Lib/dbm/__init__.py
--- a/Lib/dbm/__init__.py
+++ b/Lib/dbm/__init__.py
@@ -24,16 +24,8 @@
         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 @@
 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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list