This is a very common problem with lambdas. Ultimately, the variable x
is looked up when the function is called, not when it is created. As such, at the end of your loop, the value of x
is 'prop4'
and all your lambdas will give you the same thing.
The commonly proposed fix is to use a default argument in your lambda. It gets evaluated when the function is created.
lambda x=x: getattr(obj,x)