Dang, you're right. It works as you'd expect without overthinking it. :-)

I guess what has always (seriously, since my undergrad years studying math!) confused me is that somehow when this function is introduced they say (g*f)(x) = g(f(x)). The professor starts by showing f(x), and then shows how you can apply g() to the result, and lo, you have defined g*f.

(I'm sorry, I refuse to learn how to type the symbol they actually use. :-)

On Sun, May 24, 2020 at 2:17 PM Tim Peters <tim.peters@gmail.com> wrote:
[Guido]
>> I’ve never been able to remember whether (f@g)(x) means f(g(x)) or g(f(x)). That pretty much kills the idea for me.

[David Mertz]
> Well, it means whichever one the designers decide it should mean. But obviously it's a thing to remember,
> and one that could sensibly go the other way.
>
> On the other hand, when I showed an example using filter() a couple days ago, I had to try it to remember whether
> the predicate or the iterable came first. Lots of such decisions are pretty arbitrary.

Best I know, f@g applies g first in every language that implements a
composition operator, and in mathematics. While that may be arbitrary,
it's easy to remember:  (f@g)(x)  "looks a heck of a lot more like"
f(g(x)) than g(f(x)) because the former leaves the identifiers in the
same order.


--
--Guido van Rossum (python.org/~guido)
Pronouns: he/him (why is my pronoun here?)