r/Python • • Nov 14 '17

Senior Python Programmers, what tricks do you want to impart to us young guns?

Like basic looping, performance improvement, etc.

1.3k Upvotes

629 comments sorted by

View all comments

Show parent comments

2

u/stevenjd Nov 15 '17

This, but you don't have to be a stickler about the 80 char line limit from PEP8. We have wide screens these days. I find 120 chars to be a nice number.

The 80 character limit has nothing to do with the width of the screen. It has to do with readability. Something like 70-90 characters is the upper limit for maximum readability, beyond that it is harder and slower for the eyes to track across the line without error.

You can probably get away with it if only a small proportion of lines reach 120 characters, say less than 10% of the code and no more than four in a row, but if you're reading code that regularly hits the 120 character limit, your reading is probably suffering, and the code probably sucks.

But then, if you're regularly hitting 80 columns, the code probably sucks too:

etc. Wide code is a code smell.

1

u/claird Nov 15 '17

Wide code is a code smell.