ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki
ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki
ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
• Adding files or directories to version control:<br />
svn add filename<br />
<strong>ASE</strong> <strong>Manual</strong>, <strong>Release</strong> 3.6.1.2828<br />
If filename is directory, also all the files within the directory are added. Note that svn commit is<br />
required before the new files are actually included in version control.<br />
• <strong>ASE</strong> documentation resides under doc directory, and is also under subversion control. See more at Writing<br />
documentation.<br />
11.1.5 Coding Conventions<br />
Importing modules<br />
In code, like the implementation of <strong>ASE</strong>, we must not use the import * syntax. Import everything explicitly<br />
from exactly the place where it’s defined:<br />
from ase.io import read, write<br />
We distinguish between scripts and code. In your own scripts, it’s OK to use:<br />
from ase.all import *<br />
which will give you the most used symbols.<br />
Python Coding Conventions<br />
Please run pep8.py and pylint on your code before committing.<br />
The rules for the Python part are almost identical to those used by the Docutils project:<br />
Contributed code will not be refused merely because it does not strictly adhere to these conditions; as long as it’s<br />
internally consistent, clean, and correct, it probably will be accepted. But don’t be surprised if the “offending”<br />
code gets fiddled over time to conform to these conventions.<br />
The project shall follow the generic coding conventions as specified in the Style Guide for Python Code and<br />
Docstring Conventions PEPs, summarized, clarified, and extended as follows:<br />
• 4 spaces per indentation level. No hard tabs.<br />
• Very important: Read the Whitespace in Expressions and Statements section of PEP8.<br />
• Avoid introducing trailing whitespaces.<br />
• Try to use only 7-bit ASCII, no 8-bit strings.<br />
• No one-liner compound statements (i.e., no if x: return: use two lines & indentation), except for<br />
degenerate class or method definitions (i.e., class X: pass is OK.).<br />
• Lines should be no more than 78 characters long.<br />
• Use “StudlyCaps” for class names.<br />
• Use “lowercase” or “lowercase_with_underscores” for function, method, and variable names. For short<br />
names, maximum two words, joined lowercase may be used (e.g. “tagname”). For long names with three or<br />
more words, or where it’s hard to parse the split between two words, use lowercase_with_underscores (e.g.,<br />
“note_explicit_target”, “explicit_target”). If in doubt, use underscores.<br />
• Avoid lambda expressions, which are inherently difficult to understand. Named functions are preferable<br />
and superior: they’re faster (no run-time compilation), and well-chosen names serve to document and aid<br />
understanding.<br />
• Avoid functional constructs (filter, map, etc.). Use list comprehensions instead.<br />
• Avoid from __future__ import constructs. They are inappropriate for production code.<br />
11.1. Development topics 189