With
Implement as a Generator
#!/usr/bin/python
 
from contextlib import contextmanager
 
def f_1(n):
    print('Call f_1() ...')
    return list(map(lambda x: x*2, n))
 
def f_2(n):
    print('Call f_2() ...')
    n[0] = 100;
 
@contextmanager
def change(n):
    n = f_1(n);
    try:
        yield n;
    finally:
        n = f_2(n);
 
l = list(range(4)) # [0, 1, 2, 3]

with change(l) as n:
    print(n) # [0, 2, 4, 6]

print(n) # [100, 2, 4, 6]
		
Reference