| Home | Trees | Indices | Help | 
        
  | 
  
|---|
| 
       | 
  
dict subclass where values can be constrained by key.
For each key, a domain can optionally be defined, which restricts the admissible values that can be paired with that key.
>>> d = TypedDict() >>> allowed_values = {'name': {'Maria', 'John'}, 'age': range(122)} >>> default_values = {'name': 'Maria', 'age': 30} >>> d.set_types(allowed_types) >>> d.update(default_values)
| Instance Methods | |||
      new empty dictionary  | 
      
  | 
  ||
      
  | 
  |||
      
  | 
  |||
| None | 
      
  | 
  ||
| D.get(k,d), also set D[k]=d if k not in D | 
      
  | 
  ||
      
  | 
  |||
| bool | 
      
  | 
  ||
| 
     Inherited from  Inherited from   | 
  |||
| Class Variables | |
| Properties | |
| 
     Inherited from   | 
  
| Method Details | 
  
 x.__init__(...) initializes x; see help(type(x)) for signature 
  | 
  
 Raise ValueError if value y not allowed for key i. 
  | 
  
 str(x) 
  | 
  
 Update D from dict/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k] 
  | 
  
 
  | 
  
 Restrict values the key can be paired with. 
  | 
  
 Check if typed keys have consistent values. Use case: changing the object that allowed_values points to can invalidate the assigned values. 
  | 
| Home | Trees | Indices | Help | 
        
  | 
  
|---|
| Generated by Epydoc 3.0.1 on Sat Nov 19 00:11:17 2016 | http://epydoc.sourceforge.net |