>>> n = [1,2,3,4] >>> filter(lambda x:x>3,n) >>> len(filter(lambda x:x>3,n)) Traceback
The docs for python 3 say it returns an iterator
"Construct an iterator from those elements of iterable for which function returns true."
In python 2 it returned a list: see here. You will need to iterate the filter object to find its length.