API Reference for Enthought Tool Suite 3.0.1

Ensures that values assigned to a trait attribute are dictionaries whose keys and values are of specified types.

TraitDict also makes sure that any changes to keys or values made that are made after the dictionary is assigned to the trait attribute satisfy the type constraints. TraitDict is the underlying handler for the dictionary-based predefined traits, and the Dict() trait factory.

For example:

class WorkoutClass(HasTraits):
    member_weights = Trait({}, TraitDict(str, float))

This example defines a WorkoutClass class containing a member_weights trait attribute whose value must be a dictionary containing keys that are strings (i.e., the members' names) and whose associated values must be floats (i.e., their most recently recorded weight).

Inherits from

Attributes

Inherited from base classes

Method summary

Inherited from base classes

Methods

© Copyright 2002-2008 Enthought, Inc.