← Back to context

Comment by secstate

3 years ago

Mixing tabs and spaces usually throws a runtime exception. I'm not gonna make a value judgement about that, but your story doesn't make sense based on how I understand py3

Edit, sorry, shoulda read your whole commebt before replying

Yep. It was a few years ago while that was stilled allowed (as I'd noted ;) ) but regardless. Significant whitespace is just annoying.. There's a lot of things that render as whitespace, and source code one might be reviewing could be printed wrapped or copied and pasted in odd ways. Other languages are more robust to this.

  • You can enable showing whitespace characters in your editor, in PyCharm they are visualised perfectly well as to not distract from the non-whitespace.

  • Never had this happen, this is largely eliminated by using tools like black or other autoformatters.

    • I feel that the main point still stands, though. Saying that Python doesn't have a whitespace problem because you can send the code through a tool that detects whitespace-related problems still acknowledges the existence of said problem.

    • And/or linters.

      This issue is no worse that having multiple different variables that look the same and only in their obscure same-looking unicode symbols.

      A linter can handle this. As can a decent font, or editor settings.

  • > There's a lot of things that render as whitespace

    Like what? As you note, mixing tabs and spaces is now an error.

    I've never understood the objection to semantic whitespace. Complaining about having to indent code correctly strikes me as being akin to complaining about having to pee in the toilet instead of the bathtub.

    • there is a huge difference between having a coding standard (handled easily by a linter on commit in most languages) and making a particular whitespace indentation a critical language feature.

      Bonus, if there's a good reason to change the linter format, you can do so. Rust handles this rather well I think.