Coding Guidelines

OK I don't want to be too prescriptive about style, but consistent style makes it easier to read and contribute code and can even reduce bugs.

Style Guide for Python Code

Writing Python code that does not suck

For now using LSR's

  • Functions and methods with test_ prefix are tests and should be in files prefixed test_ in a testing directory. Ditto Classes prefixed Test. Filenames ending in _test are reserved for tests but not used.
  • No line longer than 80 chars
  • No function longer that 30 lines

Plus these from Py project REVIEW: conflicts with LSR but I don't like Uppercase much

  • generally we want to drive and interweave coding of documentation, tests and real code as much as possible. Without good documentation others may never know about your latest and greatest feature.
  • directories, modules and namespaces are always **lowercase**
  • classes and especially Exceptions are most often **CamelCase**
  • types, i.e. very widely usable classes like the py.path family are all lower case.
  • never use plural names in directory and file names
  • functions/methods are lowercase and _ - separated if you really need to separate at all
  • it's appreciated if you manage to name files in a directory so that tab-completion on the shell level is as easy as possible.