3 ms·
65-80 for readability however once you introduce indentation this naturally increases. I always felt that shorter lines were a good way to encourage less nested
by rusk 2y ago
65-80 for readability however once you introduce indentation this naturally increases. I always felt that shorter lines were a good way to encourage less nested code. Alas after all these years the consensus is against me.
- anonymous_union 2y agoi'm with you
- accrual 2y agoI still like 80 columns even on modern hardware and displays. It encourages me to keep my lines tidy and to break long lines apart. Sometimes I go a little over, but it's a nice target to reach for.
- DeliriousDog 2y agoCompletely agree on limiting yourself reducing the nesting of code. There is more difficulty working with code such as if x { //... } else { //... } Than code like if x { // returns from this block } // execution continues In some legacy code I sometimes encounter very long chains of checks which nest 4-8 layers, which becomes very difficult to maintain a mental model of where you are in execution at any point. I try to refactor into the second pattern from above when possible.
- tariksbl 2y agoagree. i think google python formatter kept lines at 65, i was surprised but it made you keep things concise & ended up much more skimmable.