Changes between Version 5 and Version 6 of ChimeraPythonStyle


Ignore:
Timestamp:
Feb 2, 2011, 11:33:11 AM (15 years ago)
Author:
Darren Weber
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ChimeraPythonStyle

    v5 v6  
    11
    2 == Chimera Python Style Guide ==
     2== Chimera Python Styles ==
    33
    4 There is no generally accepted convention for python coding style in Chimera.  I follow an interpretation of the python style guidelines by Guido, see the snippet below and the full spiel at: http://www.python.org/dev/peps/pep-0008/
     4There is specific convention for python coding style in Chimera.  Developers are free to use a familiar coding style, so long as it is consistent.  To follow a familar and consistent style, I've adopted the python style guidelines by Guido (see [http://www.python.org/dev/peps/pep-0008/ PEP8]).
    55
    6 My style is 4 spaces for each indentation level (no tabs).  My .vimrc contains:
     6The style is 4 spaces for each indentation level (no tabs).  It can be coded into a .vimrc like so:
    77{{{
    8 " global settings
    9 set tabstop=4
    10 set shiftwidth=4
    11 set expandtab
    128" python settings
    139autocmd BufRead,BufNewFile *.py set ft=python ai sw=4 ts=4 sta et fo=croql foldmethod=indent
    1410}}}
    1511
    16 It's possible to insert a mode line into each file to override user editor settings.  The first line of the file might contain something like this (which should work for both emacs and vim):
     12It's also possible to insert a mode line into the first line of a python file to override any editor settings.  The first line of the file might contain something like this (which should work for both emacs and vim):
    1713{{{
    1814# -*- coding: utf-8; mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=python:et:sw=4:ts=4:sts=4:fdm=indent:fo+=croql
    1915}}}
    2016
    21 Note that the encoding (coding) is utf-8 here, which is recommended for python 3.x, but earlier versions are recommended to use ISO-8859-1, so the PEP8 recommends a mode line like this:
     17Note that the encoding (coding) is utf-8 above, which is recommended for python 3.x, while python 2.x recommends ISO-8859-1, e.g.:
    2218{{{
    2319# -*- coding: ISO-8859-1; mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=ISO-8859-1:ft=python:et:sw=4:ts=4:sts=4