Item
Home Up History Media Collector Condition Item

 

Module "history_item"

Class Item

An item consists of three parts: a name, a definition, and a context in which to resolve that definition in order to determine its value. The context given can be a dictionary, the name of a module, or the module object itself. In the latter two cases the "__dict__" attribute of the module is used.

To create an item:

Item (name, definition, context = "__main__")

An instance of Item has four attributes: name, definition, context, and static. The attribute context will be the dictionary chosen by the argument context.

If the item does not vary over time, set the item's attribute static to true. This will cause the item to be just stored once when processed by certain media. The default value of static if false.

The only method in class Item is value (). This returns the result of calling eval (self.definition, self.context); that is, the string definition is evaluated in the given context and the resulting value is returned.