Team. Coco Team. Coco - 1 year ago 93
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.

Answer Source

Here you go:

for i, k in self.iterate(self.key):
    yield i
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download