The problem is not that filter
it is not iterable, but rather the fact that you do the unpacking in the for loop header:
for index, item in arr:
arr
, ( index, item
"" , Python index, item = 1
?). enumerate(..)
, :
for index, item in enumerate(arr):
enumerate(..)
, ( ), - . , enumerate([1, 'a', 25])
(0, 1), (1, 'a'), (2, 25)
.
, item
index
:
for item in arr: