def foo(lst): a = 1 res = map(lambda x: x + a + 1, lst) return list(res) a = 2 x = foo([1, 2])