I have the following python code.
[1, 2, 3, '4', '55', 6]
>>> a =[1,2,3,'4','55',6] >>> filter(lambda x: isinstance(x, int),a) [1, 2, 3, 6]
int will convert each object to integer and since all numbers/strings on the list are non-zero
filter picks them all since they evaluate
True in boolean context. Instead of that it seems that your goal is to pick objects that are already ints and that can be done with