On Jan 24, 2012, at 11:24 AM, Ian Tickle wrote: > Maybe a Python expert will answer this > but I've often wondered, what happens if as some editors do > (particularly if as I do you have to use different editors at > different times depending on where you are working, such as on Windows > working remotely from home or Linux at work), you could have a mixture > of space and tab characters in the file?
Just have a policy of no tabs. I make sure all of my editors interpret a tab as a set number of spaces (I like 2). A tab was meant as a separator and not a formatting character anyway. Have you ever edited a document where someone used 8 tabs to center a line of text rather than simply applying "centered" formatting? If you have, you'll realize that tabs are not meant to be formatting characters. When I first picked up a python book and it told me that indent had semantic relevance, I immediately thought of fortran, so almost gave it up. Two days later, python's use of whitespace seemed more natural than the alternative. Let's look at the Java hello world program again class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } } Notice that this obviously veteran programmer has used whitespace formatting in a natural way to improve the readability of the code. Java did not enforce this. If a language harnesses this formatting for semantics, then all of the brackets and the semicolon become redundant. You probably already format your code in a way consistent with python's whitespace rules if you have been programming for any length of time. James