24.02.20 02:27, Aaron Hall via Python-ideas пише:
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

I still have no idea what this operator does.

You can use a function or a method:

    sim(Lottery, Literacy + Wealth + Region)
    Lottery.sim(Literacy + Wealth + Region)

or

    sim(Lottery, Literacy) + Wealth + Region
    Lottery.sim(Literacy) + Wealth + Region

Operators are used to simplify the code because virtually all know what "+" and "/" mean. The same operators have similar meaning in different programming languages and not only. And they are often used many times in a row, like `a + b/(c+d)`.
_______________________________________________
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/JU2TSDJHG6QGEERE3LY27UT2VWHHHOGV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to