help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: how to highlight block end in Python-mode indentation


From: Skip Montanaro
Subject: Re: how to highlight block end in Python-mode indentation
Date: Sun, 21 May 2017 09:16:30 -0500

> PEP8 just says about using space.
> It is more of a popular way of doing things rather than a highly convincing
> advantage.

You are correct that PEP8 is convention, not stricture. Still, it was
written from experience by Guido van Rossum and a few other Python
experts. Despite the fact that it is only convention,
PEP8-compatibility is often an expectation by tools such as pylint,
and by other developers who need to read code others have written.
There is a certain amount of cognitive dissonance when you read Python
code written by someone whose personal coding style is much different
than what PEP8 outlines.

There are two advantages to using spaces:

1. Indentation (assuming < 8 spaces per indent) doesn't take the start
of the line so far to the right. If you use tabs, at the third level
you've already gobbled up 24 spaces. If (like many, but not all,
people) you work in an 80-column window, you've now got only 55
columns left for the actual bit of code on that line (assuming you
only go to column 79, which is typical). That means you wrap lines
more often and extend the vertical space necessary to express the
concept embodied in that code.

2. Woe unto anyone who winds up (accidentally or otherwise) mixing
spaces and tabs.

> I personally worked with both tabs and spaces and never find any major
> problem as such.

Don't worry, that day will come.

> Just that I am myself blind and find managing tabs with screen readers more
> convenient, but I am not against using any style.
> Never the less found white-space as the default in Emacs and is ok with my
> team who needs to see the code (unlike me who depends on speech ).

I don't think the fact that you are blind came up earlier in the
discussion. My apologies if I missed it. I don't know how you read
what's on the screen, but I can certainly understand that the computer
saying "TAB" instead of "SPACE SPACE ..." would be much easier.

I would be interested in your experience (off-list is almost certainly
best in this case) in how you adapt various coding conventions
(including PEP8) to work with your blindness. For example, you
mentioned TAB vs. SPACE. What about 80-columns? Different
capitalization for different types of identifiers?

Best,

Skip Montanaro



reply via email to

[Prev in Thread] Current Thread [Next in Thread]