4 ms·
I think that is List Comprehension and not Generator. 'Return' would be replaced by 'Yield' in case of a generator.
by l0nwlf 16y ago
I think that is List Comprehension and not Generator. 'Return' would be replaced by 'Yield' in case of a generator.
- deleted 16y ago[deleted]
- gurraman 16y agoYou can use parens instead of brackets to create a generator (generator expression). (for x in y) Edit: in the case of lambdas I'm fairly sure that you can omit the parens as well as they are implicit. I'd still write them out though. Can't test as I'm on my ipad.