8 ms·
I just translated all my build scripts written in Python to straight C due to indentation issues. Not because I don't format my code properly, but because any t
by HexDecOctBin 2y ago
I just translated all my build scripts written in Python to straight C due to indentation issues. Not because I don't format my code properly, but because any time I refactored my code, I ended up with dozens of subtle indentation related bugs that took hours to find and fix.
If your language requires an IDE, then you have become Java.
- simonw 2y agoWhat text editor do you use?
- gunian 2y agowhy? black automatically formats code
- kstrauser 2y agoPython doesn't require an IDE, but you'll definitely want to use a programmer's editor with it. I don't know what you're using that doesn't handle its indentation correctly because I haven't seen anything like that in at least a decade, but you may wish to upgrade to at least a newer vim or emacs.
- sanderjd 2y agoI don't relate to this at all. I don't understand how you refactor, in either python or C or anything else, without fixing indentation after you move code around. Yes, in C you don't have to fix the indentation in order to get it to compile and run, but that doesn't mean you don't have to fix the indentation! You can't just leave it inconsistent, that's insanity.
- wakamoleguy 2y agoOf course you can leave it inconsistent! If whitespace is insignificant, you can move things around however you want and use (frequent) runs of a code formatter to clean things up for you. If whitespace is significant, it must be fixed manually line by line.
- sanderjd 2y agoCode formatters work just fine in python. If you're running a code formatter frequently, that is not "leaving it inconsistent".
- wakamoleguy 2y agoIf we’re talking about pasted code not having the proper indentation, that’s a major difference between languages with and without significant whitespace. A formatter can fix that in C, but not in Python. Additionally, manual fixing of the indentation is required first.
- sanderjd 2y agoI just don't think this is really a problem. My editor doesn't actually have trouble putting pasted code at the right indentation level...
- dgfitz 2y agoHours? And C was a better option for scripting than python? I’ll give you the benefit of the doubt, this sounds very curious.
- HexDecOctBin 2y agoPretty much. Partly because I have developed a pretty robust C standard library that I allows for writing code that is not too dissimilar from the kind of Python I was writing. And one shot processes mean that I can simply allocate memory without having to free it (and use arenas for one script that is a long-lived file-watcher).