I've read the flame wars over the use of spaces and tabs. When working with any markup language (when scope isn't very important and when pressing space 4 times is a PITA), I tend to minimize the tab width to just a space or two but I fluidly change to four full tabs for my other programming work.
It is a matter of convenience most of the time and it only translates into real errors when sharing or mixing code. So why they don't just declare a format for optional overrides such as #tab = 2
at the beginning of a file? There would be no scoping issues and it could be handled with 2 lines of code.
Update
Whoa, I didn't explain myself very clearly: I only use editors that handle the tab/space conversion automatically. The only cogent point I can understand in the criticisms I have read regarding Pythons use of white space is how borked the space/tab convention becomes when sharing code.
Perhaps my confusion about using "4 spaces" is because of my prior life in the publishing industry and our use of tabs not as a unit of white space but an abstract element used to describe a document's structure, not the display. Substituting it with 4 spaces has more to do with Unix's shitty 8-space convention than it does with elegance. If Python standardized on using tabs by default we would eliminate the layer of abstraction (literal visual spaces -> abstract tab) that is getting lost when we leave IDE land and go to Usenet/chat/email land. I thought that #tab=2
would be a nice way to ensure that any differences originating due to convenience formatting wouldn't muck things up elsewhere.
nano
) allows you to press tab once instead..vimrc
file::set expandtab
to make pressing the tab key create spaces and:set tabstop=4
to make each time I press the tab key make 4 spaces. For emacs: emacswiki.org/emacs/NoTabs. Other editors will let you do the same, you just need to find out how, but in any case if you are using any sort of a good IDE there's no reason that you need to be pressing the space 4 times in a row.