re = [2, 3, 4, 5, 6, 7, 8]
result = []
a=list(map(lambda n:result.append(n), [i for i in re if i>5]))
print(result)
print(a)
If you run the above code, the value of result comes out correctly
re = [2, 3, 4, 5, 6, 7, 8]
result = []
a=list(map(lambda n:result.append(n), [i for i in re if i>5]))
print(result)
print(a)
The value of the result changes depending on whether the list is wrapped in a map or not, but I wonder why.
I expected a value to be added to result, but it is not added unless I wrap it in a list.