On Mon, Jan 10, 2022 at 3:49 AM Christopher Barker <pythonchb@gmail.com> wrote:
If "x->y" is syntactically valid anywhere in Python code, it's not a problem that there are no core data types for which it's meaningful.)
Here's where I'm not so sure -- this looks a lot like a binary operator, but it behaves quite differently. IIUC it would always create a Callable, regardless of what the types were of the two other types. And it would not invoke a dinder on either, yes.
Nor would it be like assignment.
This is even worse than the use of [] in type hinting which is also using the same sytax for a very different meaning -- at least that one is stil calling __getitem__ :-)
From my understanding, "x->y" would create a Callable if given two *types*, but its meaning if given two other objects is still undefined. So there's still room for it to be an operator, just like [] is, and for it to be given semantic meaning for the 'type' type and all of its subclasses. Or alternatively, there's room for it to be given meaning in a completely different way, but still universally (there's a proposal for it to be a form of inline function, although I'm not 100% sure of the details there). ChrisA