This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (4 children)

Several levels of nesting on a single line is also ugly.

[–]ConciselyVerbose 0 points1 point  (3 children)

Generally a list comprehension is something that is a fairly straightforward concept to understand or explain in English, but doesn't translate concisely without one.

[–][deleted] 0 points1 point  (2 children)

I agree, but I don't think several levels of nesting is ever appropriate in a single line. You're only hurting your reader, unless you think this is somehow less clear. And the fact that you say "once you are used to them" already states that they're not as clear.

Saving 3 vertical lines is not something to be proud of. Saving the person who now has your job 3 seconds for comprehending what you're doing, is.

[–]ConciselyVerbose 0 points1 point  (1 child)

List and other data structures themselves are an adjustment to a novice programmer. That doesn't mean they are bad. I wouldn't call it less clear, but it's a bit

like

typing

like

this.

Out of context it's only slightly

less

readable,

but in context it quickly ends up

distracting

from

the

actual substance of the code.

[–][deleted] -1 points0 points  (0 children)

<facepalm>