![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.python archiveRe: Memoization and encapsulation
From: Raymond Hettinger <python@rcn.com>
Date: Sat Dec 31 2005 - 06:09:38 CET
Steven D'Aprano wrote:
Try something like this:
def func(x, _cache={}):
* If cache hits are the norm, then a try/except version would be a bit
* In your original code, the global declaration wasn't needed because
Raymond
|