Skip to content

Commit

Permalink
Explicitly convert filters to lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
jklmli committed Aug 21, 2013
1 parent a429f5f commit 2b47876
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/underscore.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ def test(value, index, list):
def filter(self, func):
""" Return all the elements that pass a truth test.
"""
return self._wrap(filter(func, self.obj))
return self._wrap(list(filter(func, self.obj)))
select = filter

def reject(self, func):
""" Return all the elements for which a truth test fails.
"""
return self._wrap(filter(lambda value: not func(value), self.obj))
return self._wrap(list(filter(lambda value: not func(value), self.obj)))

def all(self, func=None):
""" Determine whether all of the elements match a truth test.
Expand Down

0 comments on commit 2b47876

Please sign in to comment.