[Tutor] Passing perimeters in dictionary values?

Alan Gauld alan.gauld at btinternet.com
Sat Feb 28 01:33:09 CET 2009


"Richard Lovely" <roadierich at googlemail.com> wrote

> > Sorry, I should have pointed out that you will need to redefine
> > all your functions to accept a parameter.
>
>Always makes me smile when (experienced) people redesign the wheel...
>
>From the docs (http://www.python.org/doc/2.6/library/functools.html):
>
> "The partial() is used for partial function application which
> “freezes” some portion of a function’s arguments and/or keywords
> resulting in a new object with a simplified signature."

I'm not sure how you would use partial in this case, I still think 
you'd
need to add a parameter to the function definitions. partial would
remove the need for lambda in some of the other solutions though.

But an interesting module that I've not seen before. Although since it 
was
only introduced in 2.5 I'm not surprised, I've been focussing more
on v3 lately rather than the new stuff in 2.5/2.6 (in fact I don't 
even
have 2.6 loaded yet and only have 2.5 on one PC...)

Thanks for highlighting it.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list