Python indentation (3 spaces)

Chris Angelico rosuav at gmail.com
Sun Oct 7 14:30:04 EDT 2018


On Mon, Oct 8, 2018 at 5:20 AM Gene Heskett <gheskett at shentel.net> wrote:
> 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.

Ask the people who maintain makefiles whether that's a good thing or
not. HINT: Many will say no.

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

VSCode runs on Linux. Also, there are easy ways to do the same sort of
thing in many editors that I've used.

> > IDLE does that also.
> >
> And idle for python-2.7 runs on linux.

(Not sure why you specifically say 2.7, as IDLE for any version of
Python runs on Linux, far as I know.)

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

I don't understand what any of this has to do with anything. Do you
suspect that your code is fraught with indentation bugs? If so, pretty
much ANY Python-aware editor will help you, as will Python 3.x, as
will Python2 with the "-tt" option.

ChrisA



More information about the Python-list mailing list