tabbing probs (was: Prothon Prototypes vs Python Classes)
rzed
rzantow at ntelos.net
Mon Mar 29 11:26:37 EST 2004
Michael <mogmios at mlug.missouri.edu> wrote in
news:406848CD.5070100 at mlug.missouri.edu:
>
>>I think you misunderstood. There is no "standard" length of
>>a tab. A tab is supposed to insert (or otherwise render the
>>equivalent of inserting) enough spaces to go to the next "tab
>>stop", which by convention is a multiple of 8 columns on a fixed
>>width mechanical typewriter. This is where tabs originated.
>>
>>
> No, I just fail to see why it matters. A tab could be 4 columns,
> 8 columns, 15 columns, or whatever on a particular editor and
> code blocks will still line up.
>
>>It matters. 8 columns is much too wide for indents in readable
>>code. People do differ on that, but that seems to be the
>>concensus.
>>
>>
> So rather than switch editors or change your editors settings
> you'd rather everyone be forced to use spaces? I presume four
> spaces? If someone uses eight spaces to indent will that also
> break the code? It seems to me that it'd be easier to configure
> an editor to show tabs as four columns, if you so desire, than
> to configure an editor to show eight spaces as four columns.
> Eight spaces is no easier to read than a tab that takes eight
> columns. It's just more typing to correct the problem.
>
> By my own preference, if I'm forced to use spaces to indent
> rather than tabs, then I'll most likely use a single space to
> indent because I don't want to deal with pressing the space and
> backspace keys multiple times (trying to keep count) to make
> blocks line up correctly. I also don't find it acceptable to use
> an editor which kludges together such space using behavior for
> me to do what tabs would have done in the first place. Overall,
> I think I find code that uses a single tab, rather than a single
> space, to be easier to read.
>
As long as you are the only one to work on your code, your
viewpoint may not cause you any problems. I and others are telling
you that tabs can cause problems with some software, and you can
rightly avoid using that software as long as you don't share your
code. Once that happens, though, things get more complicated.
One aspect of the tab/spaces issue involves working on other
people's code. You like tabs, I like spaces. Supposing that I
prefer to show a single level of indention as five spaces (for some
reason), what happens when I have to make a change to your code? If
I am aware that you use tabs, then I can adjust to it, but how do I
become aware? To me, it looks like you're putting five spaces in
for each level of indention. The chances are that I won't know
otherwise until I've made some changes, saved the file and tried to
run it. If some of those changes involve changing an indention
level, I may insert spaces before or after your tabs, so now such a
change leaves a line with mixed tabs and spaces, but no visible
indication of which is where. Now when someone else grabs the code
and displays it with tabs set to four spaces instead, what happens?
No sympathy there, either, I would bet, but you do see how things
like that can happen even using only your tools, don't you?
--
rzed
More information about the Python-list
mailing list