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.
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.
Perl code, unmaintainable?? :-)
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.
Yeah. Like regular expressions....:-)
Join our real-time social learning platform and learn together with your friends!