3 ms·
That's what I was saying : this is from somebody not knowing Python. Generators have a "send()" method to push data in it. We have yield from to delegate to s
by sametmax 11y ago
That's what I was saying : this is from somebody not knowing Python.
Generators have a "send()" method to push data in it.
We have yield from to delegate to sub coroutines.
And generators can be classes for more advanced behaviors.
All this lib does is to make something that already exists in the language, in a heavier and slower way.
- danidiaz 11y ago> Generators have a "send()" method to push data in it. What would be the pythonic way of "mapping over" the inputs that are sent into a generator, or performing grouping operations on those inputs? For example, how to transform a generator that expects to be sent sets of strings into a generator that simply accepts a flat stream of strings?
- rob_smallshire 11y agoYou could use the python-transducer library <https://github.com/sixty-north/python-transducers> https://github.com/sixty-north/python-transducers> I mentioned in my other comments to do this. It supports using the same transducers with iterables and push-event coroutine generators.
- sametmax 11y agoYou don't, you chain small generators. Compositions of generators transforming data is the key.