diff options
author | Éric Araujo <merwok@netwok.org> | 2011-04-20 16:52:55 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-04-20 16:52:55 (GMT) |
commit | f8e1b607994028c826401c7f6f3637d9c797ed25 (patch) | |
tree | fabf6cef116dce0cac9a98dc54e79adfd7b06e2b /Lib/dbm | |
parent | dcb22a39366f7bea8aa3359803ee32fe46debf58 (diff) | |
download | cpython-f8e1b607994028c826401c7f6f3637d9c797ed25.zip cpython-f8e1b607994028c826401c7f6f3637d9c797ed25.tar.gz cpython-f8e1b607994028c826401c7f6f3637d9c797ed25.tar.bz2 |
Add docstring to dbm.open
Diffstat (limited to 'Lib/dbm')
-rw-r--r-- | Lib/dbm/__init__.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Lib/dbm/__init__.py b/Lib/dbm/__init__.py index 99c1637..57be17b 100644 --- a/Lib/dbm/__init__.py +++ b/Lib/dbm/__init__.py @@ -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: |