def dict_property(store, index):
 if hasattr(store, '__call__'):
  getter = (lambda self: store(self)[index])
  setter = (lambda self, value: store(self).__setitem__(index, value))
 elif isinstance(store, str):
  getter = (lambda self: self.__getattribute__(store)[index])
  setter = (lambda self, value: self.__getattribute__(store).__setitem__(index, value))
 else:
  getter = (lambda self: store[index])
  setter = (lambda self, value: store.__setitem__(index, value))
 return property(getter, setter)

def dict_property ( store , index ) : if hasattr ( store , '__call__' ) : getter = ( lambda self : store ( self ) [ index ] ) setter = ( lambda self , value : store ( self ) . __setitem__ ( index , value ) ) elif isinstance ( store , str ) : getter = ( lambda self : self . __getattribute__ ( store ) [ index ] ) setter = ( lambda self , value : self . __getattribute__ ( store ) . __setitem__ ( index , value ) ) else : getter = ( lambda self : store [ index ] ) setter = ( lambda self , value : store . __setitem__ ( index , value ) ) return property ( getter , setter )
helper to create class properties from a dictionary .