-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
When I merge two streams like so:
sources = aiostream.stream.merge(genstrings1, genlists2)
with sources.stream() as events_gen:
for event in events_gen:
... # Does event come from gen1 or gen2?then I have to test the data to determine which of the source generators this event — I hope it's okay I refer to the data as events — was taken from. This is not always possible. For instance, if I have two sources generating strings, there is no sure way to discern which source stream generated a given string.
Would you consider something like this in addition?
sources = aiostream.stream.mergetuple(gen1, gen2)
with sources.stream() as events_gen:
for gen, event in events_gen:
if gen == gen1:
# event comes from gen1
elif gen == gen2:
# event comes from gen2Or is there another way?
I am currently using ziplatest and keeping track of each object so that I can identify which of the items in the zip actually changed vs. the last iteration. This is quite ugly, I find.
Looking forward to ideas, or a sign that you'd be open to a PR…
Metadata
Metadata
Assignees
Labels
No labels