We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
stream_eval
1 parent ff00223 commit c2e87a5Copy full SHA for c2e87a5
unification/core.py
@@ -31,27 +31,27 @@ def stream_eval(z, res_filter=None):
31
if not isinstance(z, Generator):
32
return z
33
34
- stack = deque()
+ stack = deque([z])
35
z_args, z_out = None, None
36
- stack.append(z)
37
38
while stack:
39
z = stack[-1]
40
try:
41
z_out = z.send(z_args)
42
43
- if res_filter:
44
- _ = res_filter(z, z_out)
+ if res_filter is not None:
+ res_filter(z, z_out)
45
+ except StopIteration:
46
+ stack.pop()
47
+
48
+ else:
49
if isinstance(z_out, Generator):
50
stack.append(z_out)
51
z_args = None
52
else:
53
z_args = z_out
54
- except StopIteration:
- _ = stack.pop()
-
55
return z_out
56
57
0 commit comments