PEP8 and 4 spaces

Rick Johnson rantingrickjohnson at gmail.com
Fri Jul 4 22:00:51 EDT 2014


On Thursday, July 3, 2014 12:31:04 PM UTC-5, Tobiah wrote:
> Coworker takes PEP8 as gospel and uses 4 spaces <snip>

I'm saddened that every one of these little "tabs versus
spaces" arguments revolve more around selfishness and less
around an understanding of what a "tabs" and "spaces"
actually *are*, because, how can you solve a problem when
you're unable to understand the fundamental dicotomoy of
this relationship between "tabs" and "spaces"?

I believe the whole issue can be boiled down into: "Use the
correct tool for the job". And there in lies the rub, before
we can make the *choice*, we must comprehend the
*differences*.

============================================================
 What is a "space"
============================================================

Duh!

============================================================
 What is a "tab"
============================================================

We all know "tabs" are used to present text in tabular form
(aka: tables), however, tabs are much more than merely a
"concatenation-of-N-spaces". Not only do tabs allow a user
to control alignments via the mechanical process of pressing
the "tab key", tabs also allow a more powerful and precise
"hook" into the underlying mechinism of vertical alignments
via "rules" defined by the user.

    AND THIS LAST POINT IS THE TRUE POWER OF "TABS"!

Yes, "tabs" are an extrapolation of "spaces", but they are
also more powerful than a "space" could ever be. If we
imagine "spaces" and "backspaces" to be like *addtion* and
*subtraction*, we can extrapolate that "tabs" and um, well,
"backtabs" to be like *multiplication* and *division* -- not
in a quantitve sense of course, but in an "exponentially
more powerful" sense. 

============================================================
 Tabs or spaces?
============================================================

And now we must answer the burning question. 

Not that my habits really matter but I myself use only
spaces and NEVER tabs, and i only use four spaces, never
more, never less,,, and i don't use spaces because i prefer
spaces over tabs, no, i use spaces because spaces are going
to render the same in all editors.

Strangly, I rather fancy the idea of using tabs in code,,,
which allow each viewer to view the code in his or her level
of indention,,, however, i cannot justify using a tab as a
replacement for a space. Tabs should be used for "tabular"
data (aka: speadsheets), and since code is NOT tabular data,
we would be wise to use the space char for indention.

    from brain import logic



More information about the Python-list mailing list