That was one thing I really liked about the Google Python guideline posted here a few days ago: Their rule about list comprehensions. "three lines max, one for the element, one for the list generation and one for the filter clause - no nesting". That's the sweet spot.
Re:Swift: The joy of sequences
by icebraining on Thursday June 09, 2016 @03:59AM
(#11868143)
And they're just wrong; that goes directly against the Zen of Python:
Simple is better than complex.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
I too have a tendency to overuse list comprehensions over regular loops, but when they start nesting I know it's almost always time to break it up.
It's OK to wonder "Can I do this one one line?" as long as you can step back and say "Yes but I'm not going to" sometimes.