Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit 4d99d3f

Browse files
use return value in | if it's already a Stream
1 parent 69ffe59 commit 4d99d3f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

stream/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ def __or__(self, other: _Function[_T_co, _V_co]) -> 'Stream[_V_co]':
1818
Override the `|` operator.
1919
:param other: An iterator function, see `functional` package.
2020
"""
21-
return IterStream(other(self))
21+
result = other(self)
22+
if isinstance(result, Stream):
23+
return result
24+
else:
25+
return IterStream(result)
2226

2327
def __gt__(self, other: _Call[_T_co, _V]) -> _V:
2428
"""

0 commit comments

Comments
 (0)