pylint: don't warn about tabs

A

Alan Isaac

I am brand new to pylint.
As a tab user, I want the tabs warning turned off.
How?

Larger question:
where is the config file format documented?

Thanks,
Alan Isaac

PS This is a wonderful tool.
 
B

Bjoern Schliessmann

Alan said:
I am brand new to pylint.
As a tab user, I want the tabs warning turned off.
How?

Advice: Don't. IIRC it's planned in future Python versions that TABs
aren't supported for indentation.

Regards,


Björn
 
B

Ben Finney

Bjoern Schliessmann said:
Advice: Don't.

Agreed. Sticking to spaces for indentation avoids the ambiguity of
interpretation that ASCII TAB characters are subject to. In addition,
PEP 8 (which many people consider a strong suggestion for a style
guide for all Python code) recommends four space characters for
indentation.
IIRC it's planned in future Python versions that TABs aren't
supported for indentation.

I've not seen such plans, can you support that?

If you're thinking of this post from Guido, please note the date it
was made:

<URL:http://www.artima.com/weblogs/viewpost.jsp?thread=101968>
 
R

Robert Kern

Alan said:
I am brand new to pylint.
As a tab user, I want the tabs warning turned off.
How?

Larger question:
where is the config file format documented?

doc/features.txt
examples/pylintrc

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
B

Bjoern Schliessmann

Ben said:
Bjoern Schliessmann <[email protected]>

I've not seen such plans, can you support that?

No ... 8)
If you're thinking of this post from Guido, please note the date
it was made:

Not this one; I thought that if there was a warning added about tabs
as whitespace recently, tabs will become forbidden in the future.

(That is not True, obviously ;) )

Anyway, thanks for correction.

Regards,


Björn
 
G

Gabriel Genellina

En Thu, 08 Mar 2007 14:33:38 -0300, Bjoern Schliessmann
Advice: Don't. IIRC it's planned in future Python versions that TABs
aren't supported for indentation.

AFAIK, using tabs xor spaces will be ok, but not MIXING them.
 
C

Colin J. Williams

Ben said:
Agreed. Sticking to spaces for indentation avoids the ambiguity of
interpretation that ASCII TAB characters are subject to. In addition,
PEP 8 (which many people consider a strong suggestion for a style
guide for all Python code) recommends four space characters for
indentation.
For those who prefer say 3 or 8, pylint permits this to be specified in
the configuration file.

Colin W.
 
A

Alan Isaac

Ben Finney said:
Sticking to spaces for indentation avoids the ambiguity of
interpretation that ASCII TAB characters are subject to.

What ambiguity?
Tabs are *less* ambiguous.
One tab character is one level of indentation.
I have never seen this violated.

Users of spaces cannot even count
on shared code being 4 rather than 8 spaces.

Even though tabs when on this score, face it,
in the end it is pure preference. There is no
"right" answer (even for emacs users). ;-)

And my actual question remains unanswered...

Alan Isaac
 
S

skip

Alan> What ambiguity?
Alan> Tabs are *less* ambiguous.
Alan> One tab character is one level of indentation.
Alan> I have never seen this violated.

The ambiguity comes when eventually your source is edited by someone else.
Perhaps you have the discipline to use only spaces or only tabs, but the guy
in the next cubicle is as likely to use spaces as you are to use tabs. Once
he edits a file the two of you share, you're toast.

This is not a new topic. After a lot of discussion over the years the
general consensus in the Python community is that spaces are the only way to
go. Here are some references:

http://www.python.org/dev/peps/pep-0666/
http://mail.python.org/pipermail/python-list/2003-January/183758.html
http://wiki.w4py.org/spaces-not-tabs.html

The Python distribution even comes with two scripts, tabnanny and reindent,
which were developed to detect and eliminate the ambiguity caused by mixing
spaces and tabs. The beginning of the reindent doc string reads:

Change Python (.py) files to use 4-space indents and no hard tab
characters. Also trim excess spaces and tabs from ends of lines, and
remove empty lines at the end of files. Also ensure the last line ends
with a newline.

If only tabs were considered to be a viable alternative to only spaces,
reindent would almost certainly have grown a flag by now to allow that.

The tag line for tabnanny reads:

The Tab Nanny despises ambiguous indentation. She knows no mercy.

Finally, note this from PEP 666:

The problem is that there is no polite way to say 'Stop wasting your
valuable time and mine.'

That's as politely as I can put it.

Skip
 
B

Bjoern Schliessmann

Alan said:
What ambiguity?
Tabs are *less* ambiguous.
One tab character is one level of indentation.

I have never seen this violated.

Not quite a proof ...
Users of spaces cannot even count
on shared code being 4 rather than 8 spaces.

You also can't count on proper TAB code.
Even though tabs when on this score, face it,
in the end it is pure preference. There is no
"right" answer (even for emacs users). ;-)
ACK.

And my actual question remains unanswered...

(--indent-string or changing a config file doesn't work for you? I
have the impression it was answered.)

Regards,


Björn
 
S

skip

Finally, note this from PEP 666:

Alan> I really think you should reread the PEP, which is making
Alan> the opposite of your point.

Quite the opposite, in fact. Laura Creighton wrote that PEP precisely with
the expectation (and hope) that Guido would reject it, which he did:

PEP: 666
Title: Reject Foolish Indentation
Version: 1083
Last-Modified: 2001-12-12 00:40:09 +0100 (Wed, 12 Dec 2001)
Author: Laura Creighton <lac at strakt.com>
Status: Rejected
Type: Standards Track
Created: 3-Dec-2001
Python-Version: 2.2
Post-History: 5-Dec-2001

Note the title and status.

Skip
 
J

John Nagle

Gabriel said:
En Thu, 08 Mar 2007 14:33:38 -0300, Bjoern Schliessmann



AFAIK, using tabs xor spaces will be ok, but not MIXING them.

That's what should be enforced. For any module, whitespace
at the beginnings of lines should be all spaces or all tabs.
Both are unambiguous and can be mechanically converted to each
other. But if spaces and tabs are mixed, there's ambiguity.

John Nagle
 
D

Duncan Booth


People who mix tabs and spaces, naturally, will find that their
programs do not run. Alas, we haven't found a way to give them an
electric shock as from a cattle prod remotely. (Though if somebody
finds out a way to do this, I will be pleased to add this option to
the PEP.)

Fortunately, since the PEP was last edited in 2001, there has been progress
on this front with the advent of the Microsoft WE-SYP programme. (see
). We should find out whether
the technology can be licensed for use in a future release of Python.
 
A

Alan Isaac

Alan:
Skip:
Quite the opposite, in fact. Laura Creighton wrote that
PEP precisely with the expectation (and hope) that Guido
would reject it, which he did: Note the title and status.

Sorry Skip, but this is really just a matter of taking off
your blinkers and learning to read. As you say, note the
title and status. Or alternatively, read this from the PEP:

I figure if I make this PEP, we can then ask Guido
to quickly reject it, and then when this argument
next starts up again, we can say 'Guido isn't
changing things to suit the tab-haters or the
only-tabbers, so this conversation is a waste of
time.'

Alan Isaac
 
A

Alan Isaac

Alan:
Bjoern:
--indent-string or changing a config file doesn't work for you?

Works great. (I read Robert's message subsequent to that
complaint.) And pylint is wonderful.

Alan Isaac
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top