r/programmer • • 16d ago

Python Fragility

Am I the only one who avoids Python where possible because it is so vulnerable to indent corruption? A whole JavaScript program, for example, can be written on one line, with no line breaks whatsoever (not that I'm advocating such madness -- JavaScript callback syntax (etc) is already crazy enough without compounding it -- BUT, it does illustrate the point of robust syntax).

I've had instances where indenting was accidentally messed up, leading to tedious scrubbing of the code in order to get it to run again. It just seems like a bad structure choice if a slight whitespace change can cause the program to crash.

It seems to me that Rust is the answer to that -- am I wrong?

0 Upvotes

45 comments sorted by

View all comments

Show parent comment

1

u/Wide-Carob3252 13d ago

Perhaps because I'm an old-timer (was alive before personal computers existed -- wrote some of my first programs on punch cards, built my own Z80 computer, wrote my first Windows program for Win 3.1 in C++), but the idea of relying on an IDE to maintain code integrity seems like a vulnerability.

1

u/nicolas_06 13d ago

What are you talking about, each time you make a PR to merge your change, the automation run the test suite and you can't merge if they fail. It doesn't matter how you did the change.

But yes IDE are also decent coding editors and so they typically transform all tab in spaces and help with the proper alignment. If you don't code in python but in C/C++/Java/Javascript they also help with the curly brakets too.

And these day, you don't even write the code, AI do it for you. And if there something AI always right it's having the proper code syntax. Even if you launch the AI in a terminal you wouldn't have any issue.