Duo Wiki

A crazy eight card game


Filed in: Main.CodingRules · Modified on : Wed, 10 Jun 09

Coding rules are critical to code consistency, new comers integration easiness, or my (David) own pleasure to read the code. As project size increases, consistency increases in importance. Unit testing and a consistent style are two utterly essential aspects of the development that, if they seem useless or boring at moments, will ease the work of everyone in the long term.

Duo code follows the very good PEP8 recommendations. Hereafter are some precisions about Duo developers preferences (or at least mine -- still David writing), since the PEP doesn't enforce everything.

  • Code layout
Always use 4 spaces for indentation, never tabs. Period.
Try to limit lines length to 80 characters. But some 10 characters more won't hurt anyone.
Use blank lines as indicated in the PEP. Don't hesitate to separate logical blocks.
Write short functions and methods. Of course, ymmv. But when a method occupies more than half the screen, it's time to think about breaking it.
  • Imports
Never ever use the form from module import *.
  • Comments
Do not use inline comments. Always write a block comment before the statement you want to explicit.

Powered by PmWiki