Op Wednesday 29 Apr 2015 09:02 CEST schreef Ian Kelly:
On Wed, Apr 29, 2015 at 12:06 AM, Cecil Westerhof ce...@decebal.nl wrote:
Op Monday 27 Apr 2015 22:35 CEST schreef Albert-Jan Roskam:
def some_func(arg, _memoize={}):
try:
return _memoize[arg]
except KeyError:
result =
On 29/04/2015 09:04, Cecil Westerhof wrote:
Op Wednesday 29 Apr 2015 09:02 CEST schreef Ian Kelly:
On Wed, Apr 29, 2015 at 12:06 AM, Cecil Westerhof ce...@decebal.nl wrote:
Op Monday 27 Apr 2015 22:35 CEST schreef Albert-Jan Roskam:
def some_func(arg, _memoize={}):
try:
return _memoize[arg]
On Wed, Apr 29, 2015 at 12:06 AM, Cecil Westerhof ce...@decebal.nl wrote:
Op Monday 27 Apr 2015 22:35 CEST schreef Albert-Jan Roskam:
def some_func(arg, _memoize={}):
try:
return _memoize[arg]
except KeyError:
result = some_expensive_operation(arg)
_memoize[arg] = result
return result
Op Monday 27 Apr 2015 22:35 CEST schreef Albert-Jan Roskam:
- Original Message -
From: Peter Otten __pete...@web.de
To: python-list@python.org
Cc:
Sent: Monday, April 27, 2015 4:28 PM
Subject: Re: Wrote a memoize function: I do not mind feedback
Cecil Westerhof wrote:
I started
Op Wednesday 29 Apr 2015 10:58 CEST schreef Mark Lawrence:
It is not only performance wise, I find the code without the try
also better looking. But that is very personally I suppose.
You might find this interesting
- Original Message -
From: Peter Otten __pete...@web.de
To: python-list@python.org
Cc:
Sent: Monday, April 27, 2015 4:28 PM
Subject: Re: Wrote a memoize function: I do not mind feedback
Cecil Westerhof wrote:
I started again with Python. In Clojure you have memoize. I thought
I started again with Python. In Clojure you have memoize. I thought it
nice to have this in Python also. So I wrote it. With a Fibonacci
function to show the usefulness.
You can find it here:
https://github.com/CecilWesterhof/PythonLibrary
I love to hear what you think of it.
And ideas for
Cecil Westerhof wrote:
I started again with Python. In Clojure you have memoize. I thought it
nice to have this in Python also. So I wrote it. With a Fibonacci
function to show the usefulness.
You can find it here:
https://github.com/CecilWesterhof/PythonLibrary
I love to hear what