Is there a way in Python to generate multiple outputs at the same time. In particular I want something like:
my_gen =(i for i in range(10))
and say I have a parameter batch_size = 3. I would want my generator to output:
my_gen.next()
0,1,2
my_gen.next()
3,4,5
my_gen.next()
6,7,8
my_gen.next()
9,10
where on the last command, it only yields two numbers because there are only two numbers left even though the batch_size is 3.