3 ms·
Newer versions of Python also have generator expressions which look similar to list comprehensions but with parenthesis instead of brackets. They mostly can be
by hedgehog 18y ago
Newer versions of Python also have generator expressions which look similar to list comprehensions but with parenthesis instead of brackets. They mostly can be used for similar purposes but they are lazy, that is they only generate results as they are requested.
- graywh 18y agoThe keyword 'yield' comes in handy for making your own generators.