comparison doc/v2_planning/coding_style.txt @ 1067:4f287324a5ad

Merged
author Olivier Delalleau <delallea@iro>
date Fri, 10 Sep 2010 10:00:49 -0400
parents e1aca94f28d8 074901ccf7b6
children 79eb0016f333
comparison
equal deleted inserted replaced
1066:e1aca94f28d8 1067:4f287324a5ad
23 * http://lists.osafoundation.org/pipermail/dev/2003-March/000479.html 23 * http://lists.osafoundation.org/pipermail/dev/2003-March/000479.html
24 * http://learnpython.pbworks.com/PythonTricks 24 * http://learnpython.pbworks.com/PythonTricks
25 * http://eikke.com/how-not-to-write-python-code/ 25 * http://eikke.com/how-not-to-write-python-code/
26 * http://jaynes.colorado.edu/PythonGuidelines.html 26 * http://jaynes.colorado.edu/PythonGuidelines.html
27 * http://docs.djangoproject.com/en/dev/internals/contributing/#coding-style 27 * http://docs.djangoproject.com/en/dev/internals/contributing/#coding-style
28 * http://projects.scipy.org/numpy/wiki/CodingStyleGuidelines
28 29
29 We will probably want to take PEP-8 as starting point, and read what other 30 We will probably want to take PEP-8 as starting point, and read what other
30 people think about it / how other coding guidelines differ from it. 31 people think about it / how other coding guidelines differ from it.
31 32
32 Dumi: we should also try to find tools that automate these 33 Dumi: we should also try to find tools that automate these
46 cond_2 and \ 47 cond_2 and \
47 cond_3: 48 cond_3:
48 49
49 * You should use two spaces after a sentence-ending period. 50 * You should use two spaces after a sentence-ending period.
50 --> Looks weird to me. 51 --> Looks weird to me.
52 (DWF: This is an old convention from the typewriter era. It has more
53 or less been wiped out by HTML's convention of ignoring extra
54 whitespace: see http://en.wikipedia.org/wiki/Sentence_spacing for
55 more detail. I think it's okay to drop this convention in source code.)
51 56
52 * Imports should usually be on separate lines 57 * Imports should usually be on separate lines
53 --> Can be a lot of lines wasted for no obvious benefit. I think this is 58 --> Can be a lot of lines wasted for no obvious benefit. I think this is
54 mostly useful when you import different modules from different places, 59 mostly useful when you import different modules from different places,
55 but I would say that for instance for standard modules it would be 60 but I would say that for instance for standard modules it would be
121 126
122 * Python versions to be supported 127 * Python versions to be supported
123 Support 2.4 (because some of the clusters are still running 2.4) and write 128 Support 2.4 (because some of the clusters are still running 2.4) and write
124 code that can be converted to 3.x with 2to3 in a straightforward way. 129 code that can be converted to 3.x with 2to3 in a straightforward way.
125 Task: Write to-do's and to-not-do's to avoid compatibility issues. (OD) 130 Task: Write to-do's and to-not-do's to avoid compatibility issues. (OD)
131 (DWF: Pauli Virtanen and others have put together extensive
132 documentation in the process of porting NumPy to Py3K, see his notes at
133 http://projects.scipy.org/numpy/browser/trunk/doc/Py3K.txt -- this is
134 the most complete resource for complicated combinations of Python and C).
135
126 136
127 * C coding style 137 * C coding style
128 How to write C code (in particular for Numpy / Cuda), and how to mix C and 138 How to write C code (in particular for Numpy / Cuda), and how to mix C and
129 Python. 139 Python.
130 Task: See if there would be a sensible C code style to follow (maybe look how 140 Task: See if there would be a sensible C code style to follow (maybe look how
149 Task: See feasibility. (OD) 159 Task: See feasibility. (OD)
150 160
151 * VIM / Emacs plugins / config files 161 * VIM / Emacs plugins / config files
152 To enforce good coding style automatically. 162 To enforce good coding style automatically.
153 Task: Look for existing options. (FB) 163 Task: Look for existing options. (FB)
164 (DWF: I have put some time into this for vim, I will send around my files)
154 165
155 Suggestion by PV 166 Suggestion by PV
156 ---------------- 167 ----------------
157 168
158 Have a sample code that showcases everything one should comply to. 169 Have a sample code that showcases everything one should comply to.