2013/11/14 Masklinn email@example.com: >
On 2013-11-14, at 16:05 , Steven D'Aprano firstname.lastname@example.org wrote:
Aside: am I the only one who wishes there was a functools.rpartial, that binds from the right instead of the left?
I’ve wanted this as well. Or the ability to somehow “fill holes”. Scala- or Clojure-type parse transforms are pretty neat for that (write the call with holes/placeholders, the call is deferred as a function taking arguments to fill the placeholders)
Examples of Scala have already been provided, in Clojure it’s an explicit reader form:
#(foo 1 2 %)
is equivalent (and expanded) to
(fn [arg] (foo 1 2 arg))
Ellipsis seems suitable for the latter:
sub5 = partial(sub, ..., 5)
(At the expense of giving up the abitily to pass ellipsis to partial functions).