Mercurial > pylearn
comparison doc/v2_planning/API_coding_style.txt @ 1180:9ebd40d31a1b
API_coding_style: Added some comments following up on what was discussed during meeting
author | Olivier Delalleau <delallea@iro> |
---|---|
date | Fri, 17 Sep 2010 16:39:29 -0400 |
parents | 67f4edabb0cc |
children | bc1b445e22fa |
comparison
equal
deleted
inserted
replaced
1179:67f4edabb0cc | 1180:9ebd40d31a1b |
---|---|
42 to do differently: | 42 to do differently: |
43 | 43 |
44 * Use only one space (not two) after a sentence-ending period in comments. | 44 * Use only one space (not two) after a sentence-ending period in comments. |
45 | 45 |
46 * You do not need to add an extra blank line before the closing quotes of | 46 * You do not need to add an extra blank line before the closing quotes of |
47 a multi-line docstring. | 47 a multi-line docstring. Also, we ask that the first line of a multi-line |
48 docstring should contain only the opening quotes. | |
48 | 49 |
49 .. code-block:: python | 50 .. code-block:: python |
50 | 51 |
51 # Good. | 52 # Good. |
52 """ | 53 """ |
308 # Good. | 309 # Good. |
309 if (cond_1 and | 310 if (cond_1 and |
310 cond_2 and | 311 cond_2 and |
311 cond_3): | 312 cond_3): |
312 | 313 |
314 # Note that we added a blank line above to avoid confusion between | |
315 # conditions and the rest of the code (this would not have been | |
316 # needed if they were at significantly different indentation levels). | |
313 ... | 317 ... |
314 # Bad. | 318 # Bad. |
315 if cond_1 and \ | 319 if cond_1 and \ |
316 cond_2 and \ | 320 cond_2 and \ |
317 cond_3: | 321 cond_3: |
322 | |
318 ... | 323 ... |
319 | 324 |
320 * When indenting multi-line statements like lists or function arguments, | 325 * When indenting multi-line statements like lists or function arguments, |
321 keep elements of the same level aligned with each other. | 326 keep elements of the same level aligned with each other. |
322 The position of the first | 327 The position of the first |