decimal.Context.canonical()

canonical(x) Returns the same Decimal object x.

decimal.Context.add()

add(x, y) Return the sum of x and y.

decimal.Context.abs()

abs(x) Returns the absolute value of x.

decimal.Context

class decimal.Context(prec=None, rounding=None, Emin=None, Emax=None, capitals=None, clamp=None, flags=None, traps=None) Creates a new context. If a field is not specified or is None, the default values are copied from the DefaultContext. If the flags field is not specified or is None, all flags are cleared. prec is an integer in the range [1, MAX_PREC] that sets the precision for arithmetic operations in the context. The rounding option is one of the constants listed in the section Rounding

decimal.Clamped

class decimal.Clamped Altered an exponent to fit representation constraints. Typically, clamping occurs when an exponent falls outside the context’s Emin and Emax limits. If possible, the exponent is reduced to fit by adding zeros to the coefficient.

decimal.BasicContext

class decimal.BasicContext This is a standard context defined by the General Decimal Arithmetic Specification. Precision is set to nine. Rounding is set to ROUND_HALF_UP. All flags are cleared. All traps are enabled (treated as exceptions) except Inexact, Rounded, and Subnormal. Because many of the traps are enabled, this context is useful for debugging.

dbm.whichdb()

dbm.whichdb(filename) This function attempts to guess which of the several simple database modules available — dbm.gnu, dbm.ndbm or dbm.dumb — should be used to open a given file. Returns one of the following values: None if the file can’t be opened because it’s unreadable or doesn’t exist; the empty string ('') if the file’s format can’t be guessed; or a string containing the required module name, such as 'dbm.ndbm' or 'dbm.gnu'.

dbm.open()

dbm.open(file, flag='r', mode=0o666) Open the database file file and return a corresponding object. If the database file already exists, the whichdb() function is used to determine its type and the appropriate module is used; if it does not exist, the first module listed above that can be imported is used. The optional flag argument can be: Value Meaning 'r' Open existing database for reading only (default) 'w' Open existing database for reading and writing 'c' Open database for reading and

dbm.ndbm.open()

dbm.ndbm.open(filename[, flag[, mode]]) Open a dbm database and return a ndbm object. The filename argument is the name of the database file (without the .dir or .pag extensions). The optional flag argument must be one of these values: Value Meaning 'r' Open existing database for reading only (default) 'w' Open existing database for reading and writing 'c' Open database for reading and writing, creating it if it doesn’t exist 'n' Always create a new, empty database, open for reading and writ

dbm.ndbm.ndbm.close()

ndbm.close() Close the ndbm database.