# HG changeset patch # User Frederic Bastien # Date 1284641998 14400 # Node ID 5f0c8ff2b3b6ce9ff8b7d3ac638bb59244792716 # Parent a1957faecc9b90452e9d38f628356e3eadf05d71 tell how do to some stuff to be compatible with python2.4 diff -r a1957faecc9b -r 5f0c8ff2b3b6 doc/v2_planning/coding_style.txt --- 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 -----------------