On Wed, 5 Jun 2019 at 09:06, Yanghao Hua <yanghao...@gmail.com> wrote:
> With my very limited understanding of cpython internals (at least when
> I implement <==) it seems cpython is searching for an operator and
> then translates it into a method call on the objects

Not really. The valid operators are hard coded into the parser and
lexer (see https://docs.python.org/3/reference/lexical_analysis.html#operators
and 
https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations
onwards) and there's no way at runtime for the user to introduce a new
operator. So any new operator requires a very low-level change to the
core of Python itself. (Not necessarily a *hard* change, but you do
have to build a custom Python interpreter). I suspect you know this
(as you've implemented <==) so I'm not entirely clear why you think
Scala's approach (which as I understand it allows arbitrary operator
symbols to be defined at runtime, and is therefore different at a very
fundamental level) is relevant.

Paul
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to