streams
streams copied to clipboard
Stream.exclude behaves the same as Stream.filter
Stream.exclude should exclude items for which the predicate returns True. It seems to actually exclude items for which the predicate returns False, same as Stream.filter.
Versions
pystreams 0.6 Python 2.7.12
Expected
> list(Stream('qewr').exclude(lambda x: True))
[]
>list(Stream('qewr').exclude(lambda x: False))
['q', 'e', 'w', 'r']
Actual
> list(Stream('qewr').exclude(lambda x: True))
['q', 'e', 'w', 'r']
> list(Stream('qewr').exclude(lambda x: False))
[]
The docs say it should behave the same as itertools.ifilterfalse, which behaves like this:
> list(itertools.ifilterfalse(lambda x: True, 'qewr'))
[]
> list(itertools.ifilterfalse(lambda x: False, 'qewr'))
['q', 'e', 'w', 'r']