Top "Generator" questions

A generator is a generalisation of a subroutine, primarily used to simplify the writing of iterators.

Is it possible to reset an ECMAScript 6 generator to its initial state?

Given the provided (very simple) generator, is it possible to return the generator back to its original state to use …

javascript generator ecmascript-harmony ecmascript-6
How to check for error when using yield instead of node-style callback?

I'm wrapping my head around the new ecma6 generators and yield-operator in javascript, specifically in the context of koa. Consider …

javascript asynchronous generator koa
What is generator.throw() good for?

PEP 342 (Coroutines via Enhanced Generators) added a throw() method to generator objects, which allows the caller to raise an exception …

python generator throw
How to mock generators with mock.patch

I have gone through the page https://docs.python.org/3/library/unittest.mock-examples.html and i see that they have …

python generator nose python-unittest python-mock
Best way to document (phpdoc) generators (methods that yield)

What is the best way to document, for phpdocumentor2, a method that is a generator. I don't think @return really …

php generator phpdoc php-5.5
Using redux-saga with setInterval - how and when to yield

Having just moved from thunks to sagas I'm trying to find the best way to call setTimeout and then from …

generator redux-saga
Programming a simple color scheme generator

we are developing a website cms in C# and want to integrate / develop a small and simple color scheme generator …

c# colors controls generator color-theory
Is there any shorthand for 'yield all the output from a generator'?

Is there a one-line expression for: for thing in generator: yield thing I tried yield generator to no avail.

python python-2.7 generator yield
Nose Test Generators inside Class

Is it possible to run nose test generators inside custom classes? I am trying to convert the example into a …

python generator nose
Turn functions with a callback into Python generators?

The Scipy minimization function (just to use as an example), has the option of adding a callback function at each …

python generator coroutine