29409Re: % matching for Python
- Aug 6, 2002On Tue, Aug 06, 2002 at 07:51:41AM -0500, Alejandro L?pez-Valencia wrote:
> What I can say from personal experience is that I've had no joy trying toThat's why the PEP8 specifies to use spaces instead of tabs. However,
> fix other people's code that had exotic indention patterns such as yours.
> Even after running pyindent.py and tabindent.py on those 2000+ LOC files,
> fixing them to not only compile but also work as expected wasn't fun at all.
> My point is that python has syntactical and orthographical regularity.
> Unlike C and C++, where indention is a matter of spiritual persuasion and
> the appearance of jihads and holy crusades among the different opinions are
> a fact of life (children!), there are clear rules for python and those
> should be the default. This way, newbies get the expected style
> transparently and those who already have a mental perversion about the
> matter, well..., we can fix it to our liking.
Python was designed to accept tabs as equivalent to spaces, but _ALWAYS_
with a tabstop set to 8. It is the setting of the tabstop to a value of
other than 8 (common for non *nix editors) that can bite. Even with the
tabstop set wrong, often you get lucky and things just work, especially
if indenting is only done with tabs.
My main reaction was to the suggestion to set the tabstop to 4 for
python code. This is going to bite someone someday. The default for
python, according to PEP8 should be
If you expect less to be able to share files with users of inconsistent
will work fine, it fits exactly what python wants. However, it may make
the code look weird if someone has a non-standard tabstop setting.
tabstop should never be set to anything other than 8 when working on
Python code. The Python lexer expands tabs to 8 spaces, so if you do
differently, there will be a mismatch between what python sees and what
is visible on the screen.
- << Previous post in topic Next post in topic >>