Reason why generators do not have references to themselves?

Claude Pache claude.pache at
Sat Jan 25 04:01:48 PST 2014

Le 24 janv. 2014 à 10:06, Bradley Meck <bradley.meck at> a écrit :

> (...) I still have to use new when invoking the generator function which feels dirty in my mind.

Interestingly, using `new` when invoking a generator function feels cleaner in my mind. :-) In short (and since it is somewhat off-topic), `new myGenerator` suggests the sensible idea of getting a _new_ iterator each time the expression is evaluated, while `myGenerator()` suggests nothing more that may be encoded in the name of the generator function.


More information about the es-discuss mailing list