Dictionaries

A dictionary is flexible data structure, providing functionality very much like a database. 

dictionary_book.gif

 

Dictionaries have the following basic attributes:

      Information is stored in the form of key / value pairs.

      Information is automatically sorted by key, resulting in fast searching and retrieval.

      Key / value pairs can be added and removed efficiently and without limit.

      Dictionaries can have root values: a value, tied to the dictionary itself rather than to a key within the dictionary.  This is optional, but it should be noted that most operators and functions will treat dictionaries as if the dictionary was simply its root value.

      Any data type may be used for the keys, although it is strongly recommended that you should use either a string or an integer.

      Any data type, including another dictionary, may be used in a value. You can use this to build complex data structures.

      These dictionaries, in spite of the illustration above, do not care whether the keys and values are nouns or verbs, integers or floats.

 

Within a dictionary, all keys will always be unique by definition.  Attempting to create a duplicate key by assigning a new value to a key with a non-unique name will simply result in the original key being assigned the new data value.

Dictionaries may be defined such that their keys are case sensitive (in which case "a" will come after "Z") or they may be non case sensitive.  Unless otherwise specified, they will not be case sensitive.

Topics in this section:

Creating a dictionary

Dictionary Operations