3 ms·
You mean generator, not list comprehension. Either way, you wouldn't `yield from` a list comprehension, you'd just use a loop. E.g. why write: yield from
by remram 5y ago
You mean generator, not list comprehension. Either way, you wouldn't `yield from` a list comprehension, you'd just use a loop.
E.g. why write:
yield from (a*2 for a in self.a_list)
When you can:
for a in self.a_list:
yield a*2
- necovek 5y agoExactly, that's the reason I used a loop in the original snippet :)