OSDir


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

Python indentation (3 spaces)


On Sunday 07 October 2018 11:32:21 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?
>
Don't recall, or care.

> > 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.

This poster is 200% correct. Somewhere, someplace, there should be easily 
found rule that dictates where one can use a tab, and where spaces only 
are allowed.

> 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?

No, and I'll give you the USA's present state of "democracy" as a prime 
example.
>
> 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.

Understatement of the month, Terry.

> > 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.

But that automatically assumes one is running in a windows environment. I 
don't allow it on the premises if I own the machine. Are there good, 
alternatives that run on linux?
>
> IDLE does that also.
>
And idle for python-2.7 runs on linux. We have a mostly python app called 
camview that runs on and with LinuxCNC. Giving us the ability to mark a 
feature on a workpiece, and create a set of co-ordinates that autoaligns 
the workpiece and a about to be carved code. But with a 640x480 camera, 
the view dies if the display window its given is equal to or larger, at 
which point it dies/goes away, whatever, and the only way to restore it 
to operational status is to reboot the machine.

I've installed idle on that particular machine, and will see if it will 
call my attention to bad coding. I'll be most appreciative if it can 
find something that will make this code Just Work(TM).  Thank you for 
mentioning it, Terry.

> --
> Terry Jan Reedy



-- 
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>