Cortex  10.0.0-a4
Public Member Functions | Public Attributes | List of all members
IECore.LayeredDict Class Reference

This class takes a stack of dictionary like objects and provides read only access to them as if they were one, falling through to lower dictionaries if the requested item isn't in the ones above. More...

Public Member Functions

def __init__ (self, dicts, dictClasses=set([dict, CompoundObject, CompoundParameter)
 Constructs a new layered dictionary : More...
 
def __getitem__ (self, key)
 
def __contains__ (self, key)
 
def keys (self)
 
def get (self, key, defaultValue)
 

Public Attributes

 layers
 

Detailed Description

This class takes a stack of dictionary like objects and provides read only access to them as if they were one, falling through to lower dictionaries if the requested item isn't in the ones above.

Constructor & Destructor Documentation

def IECore.LayeredDict.__init__ (   self,
  dicts,
  dictClasses = set( [ dict, CompoundObject,
  CompoundParameter 
)

Constructs a new layered dictionary :

dicts : a list of dictionaries to layer. dicts[0] has highest precedence and dicts[-1] lowest. after construction this list can be accessed as LayeredDict.layers, and may be modified in place to change the layering.

dictClasses : a set of classes to consider as dictionary types. this comes into play when layeredDict["key"] yields an object of that type. in this case the object is not returned alone, but instead a new LayeredDict of that object and any others with the same key is returned - this allows the layering to continue in dictionaries held within the topmost dictionary.

References IECore.LayeredDict.__dictClasses, IECore.LayeredDict.__getitem__(), and IECore.LayeredDict.layers.


The documentation for this class was generated from the following file: