git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python indentation (3 spaces)


It's also useful to be aware of the standard tabnanny module for 
"Detection of ambiguous indentation".

Very useful for highlighting problems with tabs and spaces.

Peter


On 8/10/2018 2:32 AM, Terry Reedy wrote:
> On 10/5/2018 11:30 PM, Ryan Johnson wrote:
>> 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.
>
> And my counter point is that a) we will not change the standard and b) 
> we deliver an editor that by default enforces the standard, and c) to 
> be fair, many other editors will do the same.
>
>> For example, the first Python library I ever tried to use was
>
> What library?? From where?
>
>> 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.
>
> I don't follow the logic.? If someone violates a law, does that make 
> the law bad?? And if people follow a law, does that make it good?
>
> People obviously should not distribute buggy messes, at least not 
> without warning.? Were you using the library with an unsupported 
> version?? Or inform the author or distributor?
>
>> 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.
>
> IDLE does that also.
>