This is something I thought before I actually used python. In practice, two identically looking pieces of code ARE. Yes, you can mix tabs and spaces, but not in the same block. The moment there is ambiguity the interpreter errors out. So, in practice this is never a problem, your text editor should not be switching on you randomly and the official style guide strongly asks you to use 4space tabs. Simply follow the official guidelines and be able to configure your text editor, and you will never think about this again if you're actually using python.
> Yes, you can mix tabs and spaces, but not in the same block.
Assuming of course all code contributors memorized the official style guidelines. And that they are responsive to such changes. I've had one similar change, reverted three times during my uni project, within span of days.
> The so-called benefits always boil down to "this suits my preferences"
The of significant white-space are:
1. Reduction of visual noise and improved readability. I find this uncontroversial. Your eye parses code by indentation, not by curly-braces. I could remove the curlies from javasscript and if the indentation was correct, you'd be able to follow it.
2. Reduction of cognitive load. Instead of giving me two jobs to do: indent correctly and match braces - Python only gives me one of those jobs.
These are real benefits that I experience whenever I work with Python. There are also genuine costs* but I find the balance to be very much in favour of significant whitespace
.
* restrictions on possible choices of syntax being the only one I think actually affects me in anything other than a theoretical sense.
Eh, most languages and tools nowadays reduce the risk of indenting incorrectly or not matching braces to near zero, so in practice there is little cognitive load either way.
Only serious cognitive load for me writing code is whether to add new line at 80 or less chars. That's about it.
No, the so-called benefits boil down to the fact that, objectively, no professional Python programmer has ever considered more than 10 seconds a day fighting this, if ever.
This doesn't take the fact that if you consider it to be an aesthetic wart then there's not much that can be done about it. But it does suggest that perhaps you should recalibrate your aesthetic senses towards something that brings so much more to the table than what it might detract.
To give you an analogy, it's like Java programmers complaining that lambda syntax is "hard to undestand". Sure, if you don't put in a little effort to learn it or work with it might, but you're missing out.
> It just works and the benefits far outweigh any cost - real or imagined.
Both the costs and benefits are largely subjective, so whether this is true of not varies considerably from programmer to programmer. Hence, why it is a perennial issue of holy wars in the community.
And if they're not using 4 spaces, they're not following one of the more important documents there is for coding in Python in a way that other people can easily read - PEP8.