Team. Coco Team. Coco - 14 days ago 4
Python Question

What is the alternate way to write this generator in Python 3?

I dont quite understand this generator, although it is for simplicity, i would appreciate if anyone knows an alternate why of coding this with the same result using like a loop or something.

yield from [i for i, k in self.iterate(self.key)]

Don't worry about the context, I'm hoping you have enough information to write an alternate way to represent this generator return. If not i can post more.

Thanks guys.


Here you go:

for i, k in self.iterate(self.key):
    yield i