Are list comprehensions in Python worth the effort? They seem like fun brainteasers, but once I write the code down it looks illegible to me -- even it works. It reminds me of some of the unmaintainable code I wrote in Perl years ago.
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
That's why the "comment" statement was invented. Just because the code works doesn't mean your job is done. Arcane coding should also include some explanatory comments to help out the next programmer to come along (which might be yourself in 6 months).
Aye, you can use comments to explain it.
List comprehensions save a whole lot of space and speed, ideal for some very complex programming.
Not the answer you are looking for? Search for more explanations.
I never found Perl unmaintainable. In fact, after a bit of effort, it became easy to read and I always had to remind myself that others were not coming in with the same background. Thus, its still a good habit to comment and document techniques which might be tricky or just out of the ordinary.