Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix implementation of rx.__iter__ #846

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions param/reactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,20 +941,9 @@ def __iter__(self):
return
elif not isinstance(self._current, Iterable):
raise TypeError(f'cannot unpack non-iterable {type(self._current).__name__} object.')
iterator = []
def iterate(value):
if iterator:
iterate = iterator[0]
else:
iterate = iter(value)
iterator.append(iterate)
try:
yield next(iterate)
except StopIteration as e:
iterator.clear()
raise e
for item in self._apply_operator(iterate):
yield item
items = self._apply_operator(list)
for i in range(len(self._current)):
yield items[i]
philippjfr marked this conversation as resolved.
Show resolved Hide resolved

def _eval_operation(self, obj, operation):
fn, args, kwargs = operation['fn'], operation['args'], operation['kwargs']
Expand Down