Mercurial > pylearn
comparison doc/v2_planning/coding_style.txt @ 1138:9583e908c572
coding_style: Add a pylearn.compat module?
author | Olivier Delalleau <delallea@iro> |
---|---|
date | Thu, 16 Sep 2010 10:59:43 -0400 |
parents | 5f0c8ff2b3b6 |
children | 7d2e65249bf9 |
comparison
equal
deleted
inserted
replaced
1137:01163683c71b | 1138:9583e908c572 |
---|---|
384 | 384 |
385 * Do not use the `all` and `any` builtin functions (they are not supported | 385 * Do not use the `all` and `any` builtin functions (they are not supported |
386 in Python 2.4). | 386 in Python 2.4). |
387 You can use numpy.{all,any} instead of import theano.gof.python25 that | 387 You can use numpy.{all,any} instead of import theano.gof.python25 that |
388 define all and any. | 388 define all and any. |
389 OD: I think we should have something like pylearn.compat.{all,any}. | |
390 numpy.{all,any} are meant to be used on arrays only. | |
389 | 391 |
390 * Do not use the `hashlib` module (not supported in Python 2.4). | 392 * Do not use the `hashlib` module (not supported in Python 2.4). |
391 You can do as in theano.gof.cc: | 393 You can do as in theano.gof.cc: |
392 ..code:: | 394 ..code:: |
393 if sys.version_info[:2] >= (2,5): | 395 if sys.version_info[:2] >= (2,5): |
396 return hashlib.md5(msg).hexdigest() | 398 return hashlib.md5(msg).hexdigest() |
397 else: | 399 else: |
398 import md5 | 400 import md5 |
399 def hash_from_code(msg): | 401 def hash_from_code(msg): |
400 return md5.new(msg).hexdigest() | 402 return md5.new(msg).hexdigest() |
403 OD: Yep, we could probably come up with such a wrapper in a pylearn.compat | |
404 module. | |
401 | 405 |
402 Mercurial commits | 406 Mercurial commits |
403 ----------------- | 407 ----------------- |
404 | 408 |
405 * How to write good commit messages? | 409 * How to write good commit messages? |