comparison doc/v2_planning/coding_style.txt @ 1162:4f1b9e0a1377

coding_style: Moved more stuff to API
author Olivier Delalleau <delallea@iro>
date Fri, 17 Sep 2010 12:56:30 -0400
parents 531e77fb67f2
children 53340a8df1fa
comparison
equal deleted inserted replaced
1160:8b65a1b27b94 1162:4f1b9e0a1377
8 - David 8 - David
9 - Olivier D [leader] 9 - Olivier D [leader]
10 10
11 Open for public debate 11 Open for public debate
12 ---------------------- 12 ----------------------
13
14 * File header:
15 - Do we put the accents in 'Universite de Montreal'?
16 OD: No (restricting code to ASCII characters is much safer)
17 - Do we put the Mercurial version number in each file?
18 OD: No (useless in my experience, if it's a release the version
19 number can be provided in the README for instance, and in
20 addition Mercurial IDs cannot be easily compared to figure
21 out which of two versions is most recent)
13 22
14 * Avoid contractions in code comments (particularly in 23 * Avoid contractions in code comments (particularly in
15 documentation): "We do not add blue to red because it does not look good" 24 documentation): "We do not add blue to red because it does not look good"
16 rather than "We don't add blue to red because it doesn't look good". 25 rather than "We don't add blue to red because it doesn't look good".
17 OD: I mostly find it to be cleaner (been used to it while writing 26 OD: I mostly find it to be cleaner (been used to it while writing
424 tout le monde redéfinissent les siens à sa façon. 433 tout le monde redéfinissent les siens à sa façon.
425 434
426 OD: This was discussed in committee's meeting. We agreed to provide ways to do 435 OD: This was discussed in committee's meeting. We agreed to provide ways to do
427 this, but not to enforce its usage. 436 this, but not to enforce its usage.
428 437
429 Consistent inf / nan
430 --------------------
431
432 OD: Use numpy.inf and numpy.nan rather than float('inf') / float('nan')?
433 (should be slightly more efficient even if efficiency usually doesn't matter
434 here - the main goal would be for everyone to use the same inf / nan to make
435 the code consistent).
436 OD: Approved during committee's meeting.
437
438 Enforcing strict testing policy 438 Enforcing strict testing policy
439 ------------------------------- 439 -------------------------------
440 440
441 The `coverage` third-party module provides a way to gather code coverage 441 The `coverage` third-party module provides a way to gather code coverage
442 statistics in the test suite. `nosetests` has a plugin that can be activated 442 statistics in the test suite. `nosetests` has a plugin that can be activated
476 * Look into recommendations on how to document a class, method, ... 476 * Look into recommendations on how to document a class, method, ...
477 * Write recommendations on when to use logging vs. warning 477 * Write recommendations on when to use logging vs. warning
478 * Make public some configuration files / plugins for vim 478 * Make public some configuration files / plugins for vim
479 * Come up with official common file header (license in particular) 479 * Come up with official common file header (license in particular)
480 480
481 Suggested per-file boilerplate
482 ------------------------------
483
484 """Module docstring as the first line, as usual."""
485
486 __authors__ = "Olivier Delalleau, Frederic Bastien, David Warde-Farley"
487 __copyright__ = "(c) 2010, Université de Montréal"
488 __license__ = "3-clause BSD License"
489 __contact__ = "Name Of Current Guardian of this file <email@address>"
490
491 We could also pull Mercurial revision info and put it in __version__, this
492 seems to be common.
493
494 Editor setup
495 ------------
496
497 (DWF:) Some enhanced configuration files for Vim that I've put a little bit
498 of work into modifying in some cases can be found at:
499
500 http://www.iro.umontreal.ca/~lisa/twiki/bin/view.cgi/Divers/VimPythonRecommendations