def setdefault ( obj , field , default ) : setattr ( obj , field , getattr ( obj , field , default ) )
how to default a value in python 3 dictionary
Set an object s field to default if it doesn t have a value
def setdefault(obj, field, default):
    """Set an object's field to default if it doesn't have a value"""
    setattr(obj, field, getattr(obj, field, default))