Loading ...
Sorry, an error occurred while loading the content.

29402Re: % matching for Python

Expand Messages
  • Bram Moolenaar
    Aug 6 12:52 AM
    • 0 Attachment
      David Brown wrote:

      > On Mon, Aug 05, 2002 at 04:04:18PM -0500, Alejandro L?pez-Valencia wrote:
      > > Bram Moolenaar wrote:
      > > >
      > > > I think Python always uses a tabstop of eight, nobody should edit a
      > > > Python file with a tabstop unequal 8 anyway. indent() matches with
      > > > what you see on the screen, thus it should work well.
      > >
      > > Actually a tabstop of four. The style guide (PEP 8, check
      > > http://www.python.org/doc/pep/ if I remember the address correctly)

      That's: http://www.python.org/peps/pep-0008.html

      > > declares: Use an indent of four and never mix tabs and spaces in the same
      > > file. That is, the default python indention plugin should set
      > > tabstop=shiftwidth=4 and expandtab as the default; trying to use tabs
      > > usually leads to madness and weird runtime errors because the bytecode
      > > compiler ends up guessing things that aren't.
      >
      > PEP8 specifies an indent of 4, and highly recommends using only spaces
      > for indenting. It explicitly states that spaces and tabs should never
      > be mixed.
      >
      > The Python language always has the tabstops at 8. Setting tabstop to a
      > value other than 8 can easily cause code to break in python (although
      > you will probably do ok, if the shiftwidth is also the same value).
      >
      > To comply with the PEP 8, you should set shiftwidth=4 and noexpandtab.

      As I read it this PEP suggests using 'expandtab'. However, I'm mixing
      tabs and spaces (e.g., one tab and four spaces for three indent levels)
      and haven't had any problem with this. Just make sure 'tabstop' isn't
      changed from its default value of 8.

      --
      An actual excerpt from a classified section of a city newspaper:
      "Illiterate? Write today for free help!"

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
      \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
      \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
    • Show all 16 messages in this topic