Hallo, Larry Troxler hat gesagt: // Larry Troxler wrote:
On Saturday 27 September 2003 05:16, Frank Barknecht wrote:
As a tab is just one character and not 8 or 2 or 4, there is no "rule" on Unix that it is eight spaces normally. The eight character thing is just the width, some editors like to show a tab.
...
In Pd or any C language this is really no problem at all, but I do program a lot in Python, and here a community project has to agree on one single indentation/tab style.
Frank, what you're describing is how tab characters are intended to be used. The problem is that all too often, they are used incorrectly; sometimes both tabs and spaces are used for indentation, or a tab character is used to indent to a specific character position. In these cases, I'm forced to try different tab spacings until I find the "right" one.
Ah, okay. Now I understand. So the tabs aren't the problem, the mixing of tabs and spaces is, because everyone and their sisters use differnet expansion widths.
Well, in Python, this is a real problem, that's why Python projects often have a style guide re. tabs, for example Webware has it here: http://webware.sf.net/Webware-0.8.1/Docs/StyleGuidelines.html
Webware has nice rules, IMO, which are:
Spaces are not used for indentation.
The real problem is mixing tabs and spaces for indentation as people have their tabs set to different widths (commonly 4 or 8). Tabs have been chosen because they're convenient, efficient and fast to cursor through.
Tabs are not used past initial indentation.
To avoid alignment problems between people who have tabs set to different widths. A common use of tabs is to align the values of a dictionary or the right hand sides of several consecutive assignment statements. There is no problem when using tabs for indentation, but when they are used past non-tab characters, the alignment will be skewed when the tab width is changed (e.g., when a different developer with a different tab width views the code).
In C it's more a cosmetic issue. CVS I think doesn't do anything about it: spaces stay spaces and tabs are tabs in the repository.
ciao