I have changed my question a bit, I think my question was not clear before. Apologies!!!
I have mentioned two cases below: one with lambda function and the other with a user defined function.
Case 1: Using a lambda function.
[lambda i: i*2 for i in range(4) ]
The output is the list of 4 same functions as given below:
[<function __main__.<listcomp>.<lambda>(i)>,
<function __main__.<listcomp>.<lambda>(i)>,
<function __main__.<listcomp>.<lambda>(i)>,
<function __main__.<listcomp>.<lambda>(i)>]
Case 2: Using a user defined function
def func(x):
return(x*2)
[func(i) for i in range(4) ]
The output here is as intended.
[0, 2, 4, 6]