2 ms·
Python: <https://wiki.python.org/moin/Generators https://wiki.python.org/moin/Generators> Javascript: <https://www.digitalocean.com/community/tutorials/underst
by cratermoon 3y ago
Python: <https://wiki.python.org/moin/Generators https://wiki.python.org/moin/Generators>
Javascript: <https://www.digitalocean.com/community/tutorials/understanding-generators-in-javascript#infinite-data-streams https://www.digitalocean.com/community/tutorials/understandi...>
The Python example is more to the point. The Javascript one gets there, but goes in a roundabout way.
- redditor98654 3y agoI still don't see where the iterator version would need to have all the values already exist but thanks for the links. To me it seems the benefit is conciseness of the implementation and its usage at the call site.