Differences between revisions 7 and 8
Revision 7 as of 2009-03-30 15:22:17
Size: 1023
Comment: hg switched to py2.4
Revision 8 as of 2009-03-30 16:25:46
Size: 1130
Comment: Add note about Python 2.4 compatibility.
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
 * don't put OS-specific hacks outside of util.py and friends.  * don't put OS-specific hacks outside of util.py and friends
 * don't use Python features from 2
.5 or later (so no conditional expressions, unified try/except/finally)

Don'ts:

  • don't use tabs
  • don't use lines longer than 80 characters
  • don't leave trailing whitespace
  • don't name functions or classes with Uppercase, CamelCase or lots_of_under_bars

  • don't make helper functions prefixed with do_
  • in general, don't make ["mpm"] use his shift key any more than he has to
  • don't use default arguments without a good reason
  • don't use a class unless it makes your code smaller and easier to read
  • don't use Unicode strings unless you really grok Mercurial's charset philosophy

  • don't put OS-specific hacks outside of util.py and friends
  • don't use Python features from 2.5 or later (so no conditional expressions, unified try/except/finally)

Do:

  • use single quotes rather than double quotes
  • use a single underscore prefix for private methods and functions
  • use a single underscore prefix for a helper function
  • add a linebreak after a colon
  • add docstrings
  • use _() to mark things for i18n
  • add testcases to the test suite
  • run the test suite

-- ["mpm"]


CategoryContributing

CodingStyle (last edited 2022-02-21 17:44:01 by RaphaelGomes)