changeset 1184:5783948b3f8c

API_coding_style: Moved the point about how to raise exception since it is found in official documents
author Olivier Delalleau <delallea@iro>
date Fri, 17 Sep 2010 16:58:16 -0400
parents bc1b445e22fa
children 4ea46ef9822a
files doc/v2_planning/API_coding_style.txt
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/doc/v2_planning/API_coding_style.txt	Fri Sep 17 16:51:09 2010 -0400
+++ b/doc/v2_planning/API_coding_style.txt	Fri Sep 17 16:58:16 2010 -0400
@@ -220,6 +220,18 @@
         def f(array=[]): # Dangerous if `array` is modified down the road.
             ...
 
+    * Always raise an exception with ``raise MyException(args)`` where ``MyException``
+      inherits from ``Exception``. This is required for compatibility across
+      all versions of Python.
+
+      .. code-block:: python
+
+        # Good.
+        raise NotImplementedError('The Pylearn team is too lazy.')
+        # Bad.
+        raise NotImplementedError, 'The Pylearn team is too lazy.'
+        raise 'The Pylearn team is too lazy to implement this.'
+
     * Use a leading underscore '_' in names of internal attributes / methods,
       but avoid the double underscore '__' unless you know what you are
       doing.
@@ -254,18 +266,6 @@
         n_samples_per_split = n_samples / n_splits
         mean_x = sum(x) / len(x)
 
-    * Always raise an exception with ``raise MyException(args)`` where ``MyException``
-      inherits from ``Exception``. This is required for compatibility across
-      all versions of Python.
-
-      .. code-block:: python
-
-        # Good.
-        raise NotImplementedError('The Pylearn team is too lazy.')
-        # Bad.
-        raise NotImplementedError, 'The Pylearn team is too lazy.'
-        raise 'The Pylearn team is too lazy to implement this.'
-
     * Use either ``try ... except`` or ``try ... finally``, but do not mix
       ``except`` with ``finally`` (which is not supported in Python 2.4).
       You can however embed one into the other to mimic the ``try ... except ...