Mailinglist Archive: opensuse (1473 mails)

< Previous Next >
Re: [opensuse] editor that does not eat out TAB characters
  • From: nordi <nordi@xxxxxxxxxxxx>
  • Date: Mon, 15 Jun 2009 19:04:21 +0200
  • Message-id: <4A367F15.8000106@xxxxxxxxxxxx>
Anton Aylward wrote:
If I recall, python only needs the indenting, it
doesn't care what's shown on the screen for you so long as its
consistent

And this is where the trouble starts if you use tabs: Consistency.
Because as soon as you (or somebody else) use a different editor on a
different machine, chances are that tabs get expanded to the wrong
number of spaces (4 or 8 or whatever). This makes your Python code look
wrong, because many editors (or the authors) will mix tabs and spaces.

So there are two rules from PEP 8 [1] that you should _really_ obey:

- Never mix tabs and spaces.
- For new projects, spaces-only are strongly recommended over tabs.

Everything else is just a major PITA! Also, always start python with the
"-tt" option, this will raise an error if tabs and spaces are mixed in a
way that is ambiguous.

Regards
nordi


[1]
http://www.python.org/dev/peps/pep-0008/

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >