Where is the Python Journal?
Alan Daniels
daniels at mindspring.com
Wed Feb 16 20:01:16 EST 2000
On 16 Feb 2000 14:08:54 -0600, the infinitely wise William Annis
(annis at biostat.wisc.edu) spoke forth to us, saying...
[snip...]
>class memoize:
> def __init__(self, fn):
> self.fn = fn
> self.args = {}
>
> def __call__(self, *args):
> if not self.args.has_key(args):
> self.args[args] = apply(self.fn, args)
> return self.args[args]
This is gold. Thank you!
P.S. Count me in as another who goes out and buys the Perl Journal on
a regular basis, even though my heart lies elsewhere. Its the closest
thing I've found to a useful sort of "algorithms monthly" magazine
that is actually written in something approaching English.
Perl-is-arcane-at-times-but-it-beat-math-notationly your's, Alan.
--
=======================
Alan Daniels
daniels at mindspring.com
daniels at cc.gatech.edu
More information about the Python-list
mailing list