app/soc/logic/dicts.py
changeset 387 c55195361cb6
parent 363 d35ffa6ca643
child 410 2af7f84f4fc7
equal deleted inserted replaced
386:33942ff6e71b 387:c55195361cb6
    20 __authors__ = [
    20 __authors__ = [
    21   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    21   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    22   ]
    22   ]
    23 
    23 
    24 
    24 
    25 def mergeDicts(target, updates):
    25 def merge(target, updates):
    26   """Like the builtin 'update' method but does not overwrite existing values
    26   """Like the builtin 'update' method but does not overwrite existing values
    27 
    27 
    28   Args:
    28   Args:
    29     target: The dictionary that is to be updated, may be None
    29     target: The dictionary that is to be updated, may be None
    30     updates: A dictionary containing new values for the original dict
    30     updates: A dictionary containing new values for the original dict
    31 
    31 
    32   Returns: the target dictionary 
    32   Returns:
       
    33     the target dict, with any missing values from updates merged in, in-place 
    33   """
    34   """
    34 
    35 
    35   if not target:
    36   if not target:
    36     target = {}
    37     target = {}
    37 
    38