(item, path)
Like recursive_lookup but returns `None` on any expected errors.
Like recursive_lookup but returns `None` on any expected errors.
Like recursive_lookup but returns None on any expected errors .
def safe_recursive_lookup(item, path):
    """
    Like recursive_lookup but returns `None` on any expected errors.
    """
    if not isinstance(item, dict):
        return None
    try:
        return recursive_lookup(item, path)
    except (KeyError, TypeError, ValueError):
        # key errors are missing keys
        # type errors are valid keys that return the wrong type
        # value errors are empty keys
        return None
def safe_recursive_lookup ( item , path ) : if not isinstance ( item , dict ) : return None try : return recursive_lookup ( item , path ) except ( KeyError , TypeError , ValueError ) : # key errors are missing keys # type errors are valid keys that return the wrong type # value errors are empty keys return None