[Python-checkins] cpython (2.7): Add docstring to anydbm.open

eric.araujo python-checkins at python.org
Mon May 2 13:39:22 CEST 2011


http://hg.python.org/cpython/rev/5c3f3d352e0a
changeset:   69770:5c3f3d352e0a
branch:      2.7
user:        Éric Araujo <merwok at netwok.org>
date:        Sun May 01 02:02:30 2011 +0200
summary:
  Add docstring to anydbm.open

files:
  Lib/anydbm.py |  24 +++++++++++++-----------
  1 files changed, 13 insertions(+), 11 deletions(-)


diff --git a/Lib/anydbm.py b/Lib/anydbm.py
--- a/Lib/anydbm.py
+++ b/Lib/anydbm.py
@@ -29,17 +29,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.
-
 """
 
 class error(Exception):
@@ -63,7 +54,18 @@
 
 error = tuple(_errors)
 
-def open(file, flag = 'r', mode = 0666):
+def open(file, flag='r', mode=0666):
+    """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.
+    """
+
     # guess the type of an existing database
     from whichdb import whichdb
     result=whichdb(file)

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


More information about the Python-checkins mailing list