4 ms·
For a very large sequence traversing it to build a list and then traversing the list to do something you could do in one traversal without creating a list may b
by dragonwriter 3y ago
For a very large sequence traversing it to build a list and then traversing the list to do something you could do in one traversal without creating a list may be undesirable.
- nomel 3y agoIn a very large sequence, you would be using numpy. I assumed the purpose of their example was some sort of clarity, over `sum(age > 17 for age in ages)`, rather than performance.