Who are the "spacists"?

Mikhail V mikhailwas at gmail.com
Mon Mar 20 22:18:42 EDT 2017

On 20 March 2017 at 16:19, BartC <bc at freeuk.com> wrote:
> On 20/03/2017 14:32, Chris Angelico wrote:
>> On Tue, Mar 21, 2017 at 1:24 AM, BartC <bc at freeuk.com> wrote:
>>> But it would be better IMO if tabs were used, with some scheme for
>>> suggesting the tab width (or set of tab stops) that is recommended (eg. a
>>> comment at the top).
>> If you absolutely have to, then sure, put a directive in some
>> machine-readable way at the top or bottom of the file. It's like the
>> coding cookie that Python follows - some editors also respect it. But
>> I would prefer to just use tabs *without* suggesting a width, because
>> each one represents *one indent*. Not a number of spaces. One
>> indentation level.
> For leading tabs at the start of a new statement that wouldn't be a problem.
> Changing the tab width shown just spreads out statements more, or less,
> horizontally.
> It works - there is no jarring misalignment - because each tab corresponds
> to the same N spaces, whatever N happens to be.
> But tabs are also used after statements, before comments for example, or to
> line up elements in tables. Then it doesn't work, because tabs may represent
> 1 to N spaces:
> Using N=4, with 1 tab before each number:
>     (one,   1),         #comment 1
>     (two,   2),         #comment 2
>     (three, 3),         #comment 3
> ...

Well, the definition of tabwidth in file could help only in theory,
As already said, one cannot define a tab as N charaters,
since character size is not a constant.
Don't assume that one uses monospaced
editor. For screen, generally, the units are pixels.
(warning: thinking too much about it can be brain-damaging)

Reasonable solution is just to be patient and wait
before IDEs can render tables inside a document depending
on the context. This would mean exactly 1 tab as separator.
Before that I'd say just don't worry much if
your layout will look not so nice, and not be so fanatic
with inserting multi-column content into the source code.

Tab-separated tables is actually what I use on a daily
basis, e.g copy-pasting from Excell to TXT file back
and forth, and my scripts parse tables usually as tab-separated
txt file.

And I'd say again, don't spam multiple spaces anywhere, it will be harder
to pluck them out for the collegues (and probably for the
document creator in the future).
My rule of thumb: if I see multiple spaces in any document,
something is probably wrong (except ASCII art:))).

So if one'd ask, this would be roughly my styleguide.


More information about the Python-list mailing list