Logo Search packages:      
Sourcecode: ipython version File versions  Download package

def IPython::ipstruct::Struct::__init__ (   self,
  dict = None,
  kw 
)

Initialize with a dictionary, another Struct, or by giving
explicitly the list of attributes.

Both can be used, but the dictionary must come first:
Struct(dict), Struct(k1=v1,k2=v2) or Struct(dict,k1=v1,k2=v2).

Definition at line 108 of file ipstruct.py.

00108                                      :
        """Initialize with a dictionary, another Struct, or by giving
        explicitly the list of attributes.

        Both can be used, but the dictionary must come first:
        Struct(dict), Struct(k1=v1,k2=v2) or Struct(dict,k1=v1,k2=v2).
        """
        self.__dict__['__allownew'] = True
        if dict is None:
            dict = {}
        if isinstance(dict,Struct):
            dict = dict.dict()
        elif dict and  type(dict) is not types.DictType:
            raise TypeError,\
                  'Initialize with a dictionary or key=val pairs.'
        dict.update(kw)
        # do the updating by hand to guarantee that we go through the
        # safety-checked __setitem__
        for k,v in dict.items():
            self[k] = v
        

    def __setitem__(self,key,value):


Generated by  Doxygen 1.6.0   Back to index