4 ms·
He’s right, of course. Though it has been a long time since I saw someone bother complaining about indentation in Python. It turns out not to really matter very
by draw_down 7y ago
He’s right, of course. Though it has been a long time since I saw someone bother complaining about indentation in Python. It turns out not to really matter very much.
- ssivark 7y agoMaybe it’s just because they’ve given up? I mean, what’s the point. > Python brings new meaning to 'off by one errors' by offering 'off by one' indentation errors. (EDIT: quoting a tweet on that thread) Imagine a long chunk of procedural code. Simple but tedious automated munging. "If conditional" codepaths depending on whitespace/indentation makes diffs very hard to read and codepaths harder to keep track of. Similarly no way to mark off logical blocks other than with comments. For any code longer than half a screenful, indentation based semantics is very unpleasant. I’ll even go a little farther and say that python has a bunch of warts for anything beyond beginner programming (and of course many nice parts too). But all of that is somewhat tangential to “freedom to have your own style”. I like standardization, auto-formatting, etc. I just wish there was better syntax for encoding structure.
- jkcxn 7y ago> If conditional codepaths depending on whitespace/indentation makes diffs very hard to read Wouldn’t this be the case in other languages too? Especially if you’re using an auto formatter
- ssivark 7y agoWhen you cut/paste/move around chunks of code, the existence of an unbalanced bracket provides redundancy which is a HUGE blessing in case you mess something up. Eg: When removing a bunch of lines from an indented python block (with empty lines above and below), you might accidentally un-indent later lines and never realize, or at least forget what was the "correct" indentation! Particularly cases where editors mess up indentation level when you delete part of a line.
- danmur 7y agoPython does have warts for sure but surely indentation for conditions isn't unusual? Python forces it but I've never written e.g C or C++ and not indented anyway.
- Shorel 7y agoI also miss the "Jump to matching bracket" functionality when analyzing Python code.