3 ms·
Additionally I find that it's easier to add complexity to the loops; once you want to start doing nontrivial things in a list comprehension, you often need to r
by xvedejas 4y ago
Additionally I find that it's easier to add complexity to the loops; once you want to start doing nontrivial things in a list comprehension, you often need to rewrite it into a loop first anyway.
- Spivak 4y ago> It's easier to add complexity to the loops This is basically selling point for comprehensions. You can't add complexity to them so any comprehension you see fits a few common loop patterns you can grok immediately. If you see an actual for loop in python it means "pay attention something odd is probably going on."