Top "Generator" questions

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

Convert generator object to list for debugging

When I'm debugging in Python using IPython, I sometimes hit a break-point and I want to examine a variable that …

python generator ipdb
Understanding generators in Python

I am reading the Python cookbook at the moment and am currently looking at generators. I'm finding it hard to …

python generator
Gradient text color

Is there a generator , or an easy way to generate text like this but without having to define every letter …

css generator gradient linear-gradients
How to len(generator())

Python generators are very useful. They have advantages over functions that return lists. However, you could len(list_returning_function()). …

python generator
Is there a mechanism to loop x times in ES6 (ECMAScript 6) without mutable variables?

The typical way to loop x times in JavaScript is: for (var i = 0; i < x; i++) doStuff(i); But …

javascript generator ecmascript-6 ecmascript-harmony
BarCode Image Generator in Java

How can I create a barcode image in Java? I need something that will allow me to enter a number …

java generator barcode
What does yield mean in PHP?

I've recently stumbled over this code: function xrange($min, $max) { for ($i = $min; $i <= $max; $i++) { yield $i; } } I've …

php generator php-5.5 yield-keyword
Can iterators be reset in Python?

Can I reset an iterator / generator in Python? I am using DictReader and would like to reset it to the …

python iterator generator
Why does next raise a 'StopIteration', but 'for' do a normal return?

In this piece of code, why does using for result in no StopIteration or is the for loop trapping all …

python iterator generator stopiteration
How to loop through a generator

How can one loop through a generator? I thought about this way: gen = function_that_returns_a_generator(param1, param2) …

python generator