3 ms·
It depends on the language's semantics. Sometimes (as in Python), `target.method(a, b)` really is two separate operations, `target.method` (which returns a boun
by munificent 2y ago
It depends on the language's semantics. Sometimes (as in Python), `target.method(a, b)` really is two separate operations, `target.method` (which returns a bound function) and then `<thing>(a, b)` which applies arguments to the result.
Even then, it's still not a prefix operation. It's postfix.
- fuzztester 2y agoWhew. (Wipes sweat off brow). Things like this are mentioned, in some detail, in the O'Reilly book Python in a Nutshell, IIRC, in the first edition, which is what I have. Couldn't quite wrap my head around all the material in that chapter, TBH. But I still like to read about such stuff, and I do understand bits and pieces of it.
- anamax 2y agoIn Python, the "." in "target . method" is an infix operator. Note that the "(" in (a, b) is also an operator. (There is some special parsing because otherwise you could do things like args = (1, 2, b=3); target.method args.) As to whether <thing from target.method><thing from (a, b)> is postfix, I'm not sure how you get there. Yes, there's an implicit funcall at the end, but there's something similar with (+ a b) or ((. target method) (arglist a b)) and we wouldn't call them postfix.
- munificent 2y agoYou're right. Function application is essentially an infix `(` operator. Not sure how I got that wrong.