[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Why is C so popular?



On Mon, 1 Sep 2003 11:18:14 +0200
Anders Arnholm <anders@arnholm.nu> wrote:
> And most of the use 4 spaces wide tabs? Or just use one tab as indention
> level? In every case that still explans why python code found on the net
> other looks realy bad indented. Don't take it personal, it just explans
> for me why it look so bad.

    Python standard indention is 4 spaces.  If you want to go to the source on
this here is what Guido van Rossum has to say about it here:
http://www.python.org/doc/essays/styleguide.html

--- SNIP ---
Indentation

Use the default of Emacs Python-mode: 4 spaces for one indentation level. For
really old code that you don't want to mess up, you can continue to use
8-space tabs. Emacs Python-mode auto-detects the prevailing indentation level
used in a file and sets its indentation parameters accordingly.

Tabs or Spaces?
Never mix tabs and spaces. The most popular way of indenting Python is
with spaces only. The second-most popular way is with tabs only. Code indented
with a mixture of tabs and spaces should be converted to using spaces
exclusively. (In Emacs, select the whole buffer and hit ESC-x untabify.) When
invoking the python command line interpreter with the -t option, it issues
warnings about code that illegally mixes tabs and spaces. When using -tt these
warnings become errors. These options are highly recommended! 

--- SNIP ---

    For better or ill that is what the Python community has come to embrace.

> If you feel that it's necessary to changes tabstop to four to get the
> code readable, then only reason to have tabstop set to four, then that
> explans why code found on the ner look bad. It's also stated in
> the Python language definition that tabstop is at 8 spaces, and changing
> this might actually changes the syntax of a program, given that the
> actually is a mix of spaces and tab in the source file. (And there is a
> recomendation not to have tabs for crossplatform compability.)

    Yes, but vim uses tabstop to determine how many spaces to put in.  Hence
tabstop to 4, expandtabs on, shiftwidth to 4.  Tabstops to know what to do
when we hit tab, expandtabs on so we don't send it out to other people,
shiftwidth to know what to do when we want to reindent.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
       PGP Key: 8B6E99C5       | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------

Attachment: pgp90qe8MDZSP.pgp
Description: PGP signature


Reply to: