Changes between Initial Version and Version 1 of ChimeraPythonStyle


Ignore:
Timestamp:
Oct 13, 2010, 12:08:50 PM (16 years ago)
Author:
Darren Weber
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ChimeraPythonStyle

    v1 v1  
     1
     2== Chimera Python Style Guide ==
     3
     4There is no generally accepted convention for 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/
     5
     6My style is 4 spaces for each indentation level (no tabs).  My .vimrc contains:
     7
     8### BEGIN .vimrc snippet
     9" global settings
     10set tabstop=4
     11set shiftwidth=4
     12set expandtab
     13" python settings
     14autocmd BufRead,BufNewFile *.py set ft=python ai sw=4 ts=4 sta et fo=croql foldmethod=indent
     15### END .vimrc snippet
     16
     17For emacs, here's a good blog on useful python tools: http://jasonmbaker.com/7-tools-for-working-with-python-in-emacs-and.
     18
     19It'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):
     20
     21# -*- 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
     22
     23
     24
     25### BEGIN PEP8 snippet:
     26Indentation
     27
     28    Use 4 spaces per indentation level.
     29
     30    For really old code that you don't want to mess up, you can continue to
     31    use 8-space tabs.
     32
     33  Tabs or Spaces?
     34
     35    Never mix tabs and spaces.
     36
     37    The most popular way of indenting Python is with spaces only.  The
     38    second-most popular way is with tabs only.  Code indented with a mixture
     39    of tabs and spaces should be converted to using spaces exclusively.  When
     40    invoking the Python command line interpreter with the -t option, it issues
     41    warnings about code that illegally mixes tabs and spaces.  When using -tt
     42    these warnings become errors.  These options are highly recommended!
     43
     44    For new projects, spaces-only are strongly recommended over tabs.  Most
     45    editors have features that make this easy to do.
     46
     47...
     48
     49Encodings (PEP 263)
     50
     51    Code in the core Python distribution should aways use the ASCII or
     52    Latin-1 encoding (a.k.a. ISO-8859-1).  For Python 3.0 and beyond,
     53    UTF-8 is preferred over Latin-1, see PEP 3120.
     54
     55
     56### END PEP8 snippet: