nisl/tutorial — pull request #41 by pgervais (2013-04-02 11:07:18+00:00)
Title: Cachemixin

I made utils.cache a method of the class CacheMixin (this function already looked like a method anyway). Some checks have been added to make its usage as transparent as possible (namely, there is no need anymore to define self.memory and self.memory_level in __init__() if no caching is requested: CacheMixin.cache() defines them if necessary.

I know there's nothing to be done about it, but "memory_level" would be better called "cache_level" and "memory" called "cache" IMO. Since the latter is used extensively in scikit-learn, I resisted the tentation to rename them.

At the same time, I started removing occurences of "except" where all exceptions are caught, which is quite dangerous, and useful only in **very rare** cases. Most of the time, it just hides programming errors and makes programs harder to debug.