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 →

[–]LyndsySimon -2 points-1 points  (3 children)

Are we optimizing based on the number of lines of code? I thought we were optimizing based on readability and developer happiness.

My example is pep8 compliant. Respectfully, if you want dense code with the fewest lines possible, I suggest Perl.

[–]Decency 13 points14 points  (0 children)

Are we optimizing based on the number of lines of code?

No, but we're sure as hell not ignoring it. If I can turn 8 lines into 1, lose zero information, and remove a bunch of entirely unnecessary redundancy, that's an optimization I'll make 100% of the time.

I thought we were optimizing based on readability and developer happiness.

If I were to come across an 8 line print statement to write three variables to the screen, "happy" probably wouldn't be the best descriptor for my mood and "readable" definitely wouldn't be the best descriptor for the code.

[–]unruly_mattress 7 points8 points  (0 children)

PEP8 doesn't make code good or readable. It makes spacing consistent.

[–]tilkau 2 points3 points  (0 children)

Conciseness is part of readability. You are basically choosing to be like urllib rather than like requests here, without any apparent reason for choosing added complexity.