Peter Harris wrote: >>* curry() >> >>* closure() >> >>* partial() >> >>* partial_apply() >> >>* delayed() >> >>* other ? bind() and bindargs() seem pretty reasonable to me. But if you don't like those, then how about fixargs() or fix_args()? That gets across the message that we're generating a new function that fixes the values of a subset of the arguments. Side note: I think that the following code will have unexpected behavior with the current implementations: >>> def f(x,y,z): return (x,y,z) >>> g = f.bind(y=3) >>> print g(1,2) TypeError: f() got multiple values for keyword argument 'y' (I would have expected this to return (1,3,2).) Of course, there's not really any way around it without using inspection, and even then you can't really inspect argument lists for builtins. But it might be worth noting in the docs the circumstances under which it's appropriate to bind w/ keyword args. -Edward
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4