Function decorator that caches function results

Lasse Vågsæther Karlsen lasse at vkarlsen.no
Sat Oct 8 11:39:30 EDT 2005


Fredrik Lundh wrote:
<snip>
>>k1 = fibonacci(100)
>>k2 = fibonacci(idx = 100)
<snip>
> whoever writes code like that deserves to be punished.
> 
> I'd say this thread points to a misunderstanding of what keyword arguments
> are, and how they should be used.  the basic rule is that you shouldn't mix and
> match; use positional arguments for things that are documented to be positional
<snip>

I agree completely.
However, it turns out I have to communicate code with and from people 
that have a coding standard that dictates using keyword arguments for 
all interfaces. Those functions will also benefit from the cache system 
as many of them involves database lookups.

In any case, your response gave me another thing that my solution won't 
handle so I'm going to just leave it as it is and look at it if I ever 
need it for positional arguments, which I honestly don't believe I will.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:lasse at vkarlsen.no
PGP KeyID: 0x2A42A1C2



More information about the Python-list mailing list