Description
Describe the bug
Stream.of(...)
consumes the underlying iterable eagerly.
Perhaps there is another way of wrapping an iterable?
To Reproduce
def gen() -> Generator[int, None, None]:
for i in range(1, 4):
print(">>")
yield i
def should_stream0():
for i in gen():
print(i)
def should_stream2():
Stream.of(gen()) \
.map(lambda i: str(i)) \
.for_each(print)
Expected behavior
should_stream2
should behave the same as should_stream0
by printing >>
interleaved with numbers.
Machine (please complete the following information):
- linux
- Python Version: 3.12.4
- PyStreamAPI Version: 1.3.0
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done