Python 3 will raise "TypeError: object of type 'filter' has no len()" when a len is called on a filter object. A quick workaround to that would be instead of having len(filter), having len(list(filter)). This practically defeats the purpose of using a filter and in my opinion is less pythonic than using a list comprehension, therefore I'm suggesting this change instead of the more straight len(list).
Python 3 will raise "TypeError: object of type 'filter' has no len()" when a len is called on a filter object. A quick workaround to that would be instead of having len(filter), having len(list(filter)). This practically defeats the purpose of using a filter and in my opinion is less pythonic than using a list comprehension, therefore I'm suggesting this change instead of the more straight len(list).