PEP8 and 4 spaces

Chris Angelico rosuav at gmail.com
Fri Jul 4 03:19:44 CEST 2014


On Fri, Jul 4, 2014 at 11:02 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> As I understand it, Unix coders tend to prefer spaces, and Windows users
> tend to be more comfortable with tabs. This isn't a hard-and-fast rule,
> you'll find plenty of exceptions, but it seems to me that Unix tools are
> unforgiving of tabs while Windows IDEs tend to default to tabs. I'm not a
> Windows person myself, any Windows guys like to comment?

I've worked both platforms extensively, and it's not really as
clear-cut as that. Most Unix tools are perfectly happy with tabs, *as
long as you let them mean eight spaces*; a lot, but not all, have an
option to configure tab width, but you have to specify it to every
program separately.

On the flip side, tab configurability can be a huge feature. There've
been times when I've looked at something with the tab width set to
something insane like 7 or 9 (no, folks, I did not say "7 of 9") to
highlight a display bug or other oddity. Not often, but it has its
uses - and you can't do that if there are actual spaces involved.

Anyone who's using a broken editor should fix it or switch editors.
That's easy. And if you really love your editor, sometimes you can fix
the issue outside it - maybe in a source control hook.

ChrisA



More information about the Python-list mailing list