Python indentation (3 spaces)

Ben Finney ben+python at benfinney.id.au
Mon Oct 8 03:13:49 EDT 2018


Terry Reedy <tjreedy at udel.edu> writes:

> You assumption that a tab means '4 spaces' is wrong.  A tab means
> 'jump to the next tab stop'.  On 10 char/inch US typewriters, tab
> stops were initially set to every 5 spaces or 1/2 inch.  In terminals
> and code editors, virtual tab stops were often set to every 8 spaces,
> and python still interprets tabs that way.
>
> This means that editing Python code in an editor that *displays* tabs
> (as opposed to converting them to spaces) with other than
> every-8-space tab stops is arguably a bad idea if the file has or
> might have non-tab space indents.

The distinctions Terry is drawing attention to are important. Often the
confusion in these discussions comes from people conflating the three
separate issues that jwz described in this classic essay
<URL:https://www.jwz.org/doc/tabs-vs-spaces.html>.

-- 
 \      “I find the whole business of religion profoundly interesting. |
  `\     But it does mystify me that otherwise intelligent people take |
_o__)                                    it seriously.” —Douglas Adams |
Ben Finney




More information about the Python-list mailing list