Aside from all the other problems, 'sim' (~) in LaTeX and mathematics means
something completely different than 'depends on' (~) in R. Trying to
overload those meaning makes everything harder.

I would recommend doing what NumPy did for many years for matrix multiply.
Use an existing operator. Yes '*' had a different meaning for matrices vs.
arrays, but that was enough to motivate the eventual addition of the '@'
operate.

In particular, I don't think this looks at all bad:

Lottery // Literacy + Wealth + Region


If anything, the slash for "ratio" is more intuitive than the tilde in R.
I'm wrestling with single versus double slash.

But if you add this to libraries with no language change needed, and it
eventually becomes popular, maybe there is a later argument for a separate
operator.

On Sun, Feb 23, 2020, 7:30 PM Aaron Hall via Python-ideas <
python-ideas@python.org> wrote:

> I have no behavior for integers in mind. I would expect high-level
> libraries to want to implement behavior for it.
>
> - sympy
> - pandas, numpy, sklearn, statsmodels
> - other mathematically minded libraries (monadic bind or compose?)
>
> To do this we need a name. I like `__sim__`. Then we'll need `__rsim__`
> and `__isim__` for completeness. We need to make room for it in the
> grammar. Is it ok to give it the same priority of evaluation as `+` or `-`,
> or slightly higher?
>
> In the past we've made additions to the language when we've been parsing
> and evaluating strings. That's what we're currently doing in statsmodels
> right now because we lack the binary (in the sense of two-arguments) `~`.
>
> See: https://www.statsmodels.org/dev/example_formulas.html
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/JWC4HJVTHQA532VIW62UXVPMOEVVR2IT/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/5S26SHCXIZJBWXU3S2WNIQ6WAVKMSRJK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to