Re:Python List Comprehensions Explained Visually
by omaranto on Wednesday December 02, 2015 @10:06PM
(#10667474)
Huh. You seem to think nobody could possibly find comprehensions as easy to read as loops. That surprises me because I think the reason they got implemented in many programming languages is precisely that many people find them easier to read!
[ Parent
| on HN ]
Re:Python List Comprehensions Explained Visually
by jonesb6 on Wednesday December 02, 2015 @11:23PM
(#10667733)
I think he's talking about more complex list comprehensions then just the traditional for-loop + map setup. I haven't been in Python land for awhile but I remember some atrocious contraptions of 80+ line comprehensions that could of been infinitely more explicit as a literal for loop.
This is Python after all.
Re:Python List Comprehensions Explained Visually
by omaranto on Thursday December 03, 2015 @11:40AM
(#10670534)
Well, rewriting a 80+ line comprehension as an 80+ line series of nested loops and conditionals wouldn't increase readability in my opinion. What would make it easier to read is to divide the computation into several smaller steps, which could be done either with several comprehensions or several loops.