def nested_setitem(lst, index, value):
    """Equivalent to the statement lst[index[0]]...[index[n]]=value"""
    setitem(
        reduce(getitem, index[0:-1], lst), index[-1], value
    )
Equivalent to the statement lst[index[0]]...[index[n]]=value
recipes/Python/578376_analogue_enumerate_nested/recipe-578376.py