2 ms·
Comprehensions have some other benefits too, for example, they're much less likely to be accidentally stateful. My general experience is that for complex logic,
by SatvikBeri 8y ago
Comprehensions have some other benefits too, for example, they're much less likely to be accidentally stateful. My general experience is that for complex logic, a comprehension is harder to write initially, but much less likely to have bugs when I get it right.
That said, I usually won't use deeply nested comprehensions, but sometimes it actually is the clearest way to parse something (e.g. extracting a field from nested JSON.)