Next: , Up: Python   [Contents][Index]


5.6.1 Python Dictionary Class

The dictionary class must define the following methods:

Method on DictionaryClass: __init__ self *argv

Class constructor. The argv array supplies positional arguments from the handler statement in the configuration file.

Method on DictionaryClass: open self dbname

Opens the database named dbname. Returns ‘True’ on success and ‘False’ on failure.

Method on DictionaryClass: close self

Closes the database.

Method on DictionaryClass: descr self

Returns a short description of the database.

Method on DictionaryClass: info self

Returns a text describing the database.

Method on DictionaryClass: lang self

Optional. Returns supported languages as ‘(src, dst)’.

Method on DictionaryClass: define_word self word

Defines word. Returns a result (an opaque Python object) if the definition was found or ‘False’ otherwise.

Method on DictionaryClass: match_word self strat word

Searches for word in the database using strategy strat. Returns a result (an opaque Python object) if some matches were found or ‘False’ otherwise.

Method on DictionaryClass: output self result n

Outputs nth result from the result set result.

Method on DictionaryClass: result_count self result

Returns number of elements in the result set.

Method on DictionaryClass: compare_count self result

Optional. Returns the number of comparisons performed when constructing the result set.

Method on DictionaryClass: result_headers self result hdr

Optional. Returns a dictionary of MIME headers.

Method on DictionaryClass: free_result self result

Reclaims any resources used by the result set.


Next: Dico Python Primitives, Up: Python   [Contents][Index]