Those kinds of problems can be hard to track down.
That said, I sure with python offered a totally optional end block thing. In many situations it would make things far more clear.
I agree with the other person that says this doesn't really happen in the real world with a baseline developer and editor.
"It isn't a problem for me, therefore it isn't a problem for anyone." just isn't a good way to reason about problems like this.
print("foo")
# x is false for the problem
if x:
do_something()
print("bar")
And to the parent who has written a lot of code but never had this problem, well, some people do.> never had this problem, well, some people do.
Neophytes also have a lot of problems with matching braces, neither is a panacea to those folks. But one is easier to read and type for everyone else, for years to come.
If the function is longer or their are a couple of additional levels of indentation, and it isn't a print statement, but some additional logic, it is a hard problem to spot.
Still at some point one needs to be responsible for the code they write, braces or not. Braces are not a guaranteed solution either, if the author gives up complete responsibility.
Basically, this is a theoretical non-problem. The lack of braces pays back in readability every single day. Like +100 + -2, then complaining about the -2.
You'll also note that I've never claimed braces were better, I'm just trying to explain OP's pont.
You may not encounter it, but "Hey it works for me" is not a legitimate answer.
In many years of writing Python I have not once encountered this issue. And I didn't always use four spaces...
Point is, I'd see this problem constantly until I figured it out. And not once did it take more than a few minutes to fix it because, as you point out, it shows you where the problem is. And if you use PyCharm, or VS Code with Python extension, or a raft of any other editors, it'll bark at you long before you try and run the code, with circles and arrows, and a paragraph on the back of each one explaining the problem.
So, yeah, the author is making shit up. And needs to learn about what the Tab key does.
this is so hilariously wrong that it is clear that the author has never actually tried any of the things he complains about.
same error in Python 2.7.15. the caret is at the wrong place, but the error message is perfectly fine on its own.edit: I checked the CPython source, and this message actually dates back to 2000. so unless the author was using python 1.x back in the 90s, or is dumb enough to use single spaces for indentation, the story is a complete fabrication.