Nick Keighley a écrit :
On 9 June, 13:50, Bruno Desthuilliers <bruno.
(snip)
Note that the lambda trick you used is very idiomatic - functool.partial
being newer and probably not as used - so one could argue that the most
common way is also the most "elegant" !-)

I'm somewhat newbie at Python but I'd seen lambda elsewhere (scheme).
I like the closure trick...

Well... Python is not Scheme - specially wrt/ lambdas and closures. While it has some restricted support for some FP idioms, Python is definitly an OO language.

FWIW, you could implement the functool.partial class using closures / HOF (and it's been done before), but it's easier and just more "obvious" to take the OO route here.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to