[Dave, this may be the second copy of this message you receive; sorry about that.] Dave Abrahams wrote: > The operation performed by the operator described here is actually > called "Partial Application". A good definition of currying can be > found in http://tinyurl.com/3d6w6 and http://tinyurl.com/ly29. I disagree. Currying is turning a function that takes its arguments all at once as a tuple into a function that takes them one at a time by partial application. So if f(1,2,3)=64 and F is the curried version of f, then F(1)(2)(3)=64. The idea of currying arose in a context where functions are fundamentally single-argument; it's a way of converting between two different ways of building multiple-argument functions on top of a single-argument-only base. That's handy for mathematicians and theoretical computer scientists, who like to keep their underlying concepts as few and as simple as possible. But in Python, and in many other programming languages, functions with multiple arguments aren't built on a single-argument substrate, so there are *three* options for passing multiple arguments to a function. - Collect args into a tuple, pass that. - Just pass multiple arguments. - Pass arguments one at a time using partial application. And the middle one, the one that isn't generally considered by mathematicians doing lambda calculus, happens to be the *usual* case. How you apply the notion of "currying" to Python, then, depends on which pair of argument-passing conventions you choose to assimilate; in other words, on which of the two distinctions at work here you choose to emphasize. Currying is ... 1. "Turning a function that takes a single tuple argument into one that takes multiple arguments." 2. "Turning a function that takes it arguments all at once into one that takes them one at a time." According to #1, what PEP309 calls currying is no such thing. According to #2, what PEP309 calls currying *is* currying. It looks to me as if the second usage is the dominant one, in which case I think PEP309 is fine. -- g
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