Python indentation (3 spaces)

Ryan Johnson rj.amdphreak at gmail.com
Fri Oct 5 23:30:53 EDT 2018


The point that OP is trying to make is that a fixed standard that is
distinguishable from the even-spacing Tab-length convention in code and
text editors will establish a level of trust between the end developer and
upstream developers or co-developers who may not have the same development
environment. For example, the first Python library I ever tried to use was
poorly maintained and had spaces on one line with tabs on the next, and the
author mixed naming conventions and syntax from Python 2 and 3 in his code.
That type of experience doesn’t exactly instill trust in the coding
language’s standards, when a noob tries to use a library they found and
ends up having to debug weird errors with weirder error messages on the
first project they do.

Flexibility is great until the learning curve comes into play. That said,
there is an easy fix for tab misuse: in Visual Studio Code, you can replace
all Tabs with Spaces by highlighting the entire code block, hitting Tab
once and Shift-Tab after.

Peace
Ryan
On Fri, Oct 5, 2018 at 4:51 PM Terry Reedy <tjreedy at udel.edu> wrote:

> On 10/5/2018 4:48 PM, ts9564 at gmail.com wrote:
> >     I am new to Python programming but have significant SQL and C
> experience. My simple question is,"Why not standardize Python indentations
> to 3 spaces instead of 4 in order to avoid potential programming errors
> associated with using "TAB" instead of 4 spaces?"
>
> IDLE (and other modern editors and IDEs) turns a typed TAB into a
> user-settable n spaces, where n defaults to 4 (minimum 2, maximum 16).
>
> --
> Terry Jan Reedy
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
Ryan Johnson



More information about the Python-list mailing list