changeset 1136:5f0c8ff2b3b6

tell how do to some stuff to be compatible with python2.4
author Frederic Bastien <nouiz@nouiz.org>
date Thu, 16 Sep 2010 08:59:58 -0400
parents a1957faecc9b
children 01163683c71b
files doc/v2_planning/coding_style.txt
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/v2_planning/coding_style.txt	Thu Sep 16 02:58:24 2010 -0400
+++ b/doc/v2_planning/coding_style.txt	Thu Sep 16 08:59:58 2010 -0400
@@ -380,11 +380,24 @@
 
     * Use either "try ... except" or "try ... finally", but do not mix
       "except" with "finally" (which is not supported in Python 2.4).
+      You can make a try... except inside a try... finally if you need both.
 
-    * Do not use the `any` and `all` builtin functions (they are not supported
+    * Do not use the `all` and `any` builtin functions (they are not supported
       in Python 2.4).
+      You can use numpy.{all,any} instead of import theano.gof.python25 that 
+      define all and any.
 
     * Do not use the `hashlib` module (not supported in Python 2.4).
+      You can do as in theano.gof.cc:
+      ..code::
+	if sys.version_info[:2] >= (2,5):
+	    import hashlib
+    	    def hash_from_code(msg):
+                return hashlib.md5(msg).hexdigest()
+        else:
+	    import md5
+	    def hash_from_code(msg):
+	        return md5.new(msg).hexdigest()
 
 Mercurial commits
 -----------------