__rcall__???

Tim Peters tim_one at email.msn.com
Thu Dec 30 18:11:52 EST 1999


[Tim]
>> No, there's no info in the manual about [__rpow__] history.
>> Misc/HISTORY (from the source distribution) doesn't say anything
>> about rpow either.  If it really matters to you when __rpow__
>> got introduced, you'll have to ask someone at CNRI to dig thru
>? old CVS diffs.

[David C. Ullrich, irked]
>     No, it doesn't matter a bit. I was assuming that your reply
> had at least _some_ relevance to the question I'd asked -

I believed it did.

> if so there would have to be information on the history in
> that section of the docs. I guess I shouldn't assume things
> like that<wink>.

I read your original question as being more about __pow__ and __rpow__
behavior than about their history.  If the history is indeed-- as it
*seemed* to me from the start --something that really "doesn't matter a bit"
to you, I don't grasp what's eating you.

>> I suspect you shot yourself in the foot by doing something like
>>
>>     from math import *
>>
>> without admitting to it <wink>.

>     Again, thanks for your assistance <wink> - I figured out I
> think it was a week or so ago that this was the problem, and
> then I "admitted" it right here, in a post that has just fallen
> off the local server. Thanks<wink wink>.

My fault:  I was away from the computer on vacation for somewhat over a
week.  Replying to your last __rcall__ msg was the last thing I did before I
left.  Your reply to that was one of the first of the 1,000+ msgs waiting in
my inbox when I returned, and I answered it before reading all the pending
msgs.  I see now that it was unnecessary; sorry for the aggravation.

> [a rant about single-argument vs multiple-argument functions]

My favorite non-Python language is Haskell, in which all functions are
curried (common jargon in the functional-language biz for "single
argument"), even addition (e.g. "+" is a function that takes (say) an
integer argument and returns a function mapping ints to ints; "- 1" is a
function that returns a function that subtracts one from its argument; "1 -"
is function that returns a function that subtracts its argument *from* 1;
etc.).

You don't need to convince me that's an elegant & very useful view of the
world.  It's simply not Python's view of the world.

Still, as you discovered, it's quite possible to write Python code to fake
it!  Python doesn't force you to write multiple-argument functions, and I'm
not even asking you to.  My only interest here is in preventing a push for
*Python's* call implementation to treat single-argument functions in a
distinguished way (as would the hypothetical __rcall__ method of the subject
line); my attempts to explain why that's unnatural in *Python* appear to be
perceived as attacks against Mathematical Truth.  They're not.  Curried
functions in Python are as much a strain as representing ints as lambda
compositions in Python (which also can-- for that matter, has --been done).

[still in sarcasm mode]
> the idea that different answers are appropriate in different
> contexts is just silly.

What would be silly is the notion that a single programming language *can*
(let alone "should") support all modes of expression with equal fluidity.

choices-have-consequences-and-python-made-some-ly y'rs  - tim






More information about the Python-list mailing list