Why do generator expressions return generators?

Domenic Denicola domenic at domenicdenicola.com
Fri Sep 6 08:48:42 PDT 2013


> The name works because they're sugar for a generator function immeidately invoked:

I mean, that's true, but *why* is that true? What is the value of allowing you to send in values via `.next(v)`, or send in exceptions via `.throw(e)`? Why not just make them sugar for creating custom iterable-iterators without shallow coroutine capabilities?



More information about the es-discuss mailing list