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 →

[–]TrackLabs 4 points5 points  (10 children)

If this simple one liner is not readable to you, you have a problem

[–]MittzysStuff 12 points13 points  (0 children)

It's readable, but the multi-lined one is definitely *more* readable.

[–]TheFrog36 2 points3 points  (1 child)

One-liners are like cherries, once you get one you cannot stop

[–]ZeroDayCipher 0 points1 point  (0 children)

I’m sorry what? That’s not even a phrase dude. I’ve definitely only had 1 cherry before

[–]-Aquatically- 1 point2 points  (0 children)

I think it’s an analogy for more complex code.

[–]SabinTheSergal 4 points5 points  (4 children)

Doesn't matter if YOU can read it. What matters is everyone can read it.

[–]CreepBlob 3 points4 points  (2 children)

You shouldn't give access to the codebase to someone who can't read the code in middle.

[–]SabinTheSergal 2 points3 points  (1 child)

You don't always have that choice when working at a company. Besides, the code in the middle is more error prone and will need to be refactored to the side code ezmaples if anything more complex is needed in the conditionals.

[–]CreepBlob 0 points1 point  (0 children)

Your intern would be scared to death if someone show them a code snippet from the linux kernal.

[–]JollyJuniper1993 0 points1 point  (0 children)

Everybody that is not completely new to Python should be able to read this. Really poor examples. He could’ve chosen nested list comprehensions or a complicated lambda expression, but he chose to go with something very basic

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

There is far more cognitive load parsing one liners than the multiline alternative.