On Fri, May 24, 2019 at 1:59 AM Steven D'Aprano
On Thu, May 23, 2019 at 06:23:31PM +0200, Yanghao Hua wrote:
Is this (<== and ==>) something can be made into CPython?
If it goes into CPython, eventually every other Python needs to do the same.
Of course it *could* be put into Python, but you haven't given sufficient justification for why it *should* be put into Python.
Why does your DSL need a seperate assignment operator? How is it different from regular assignment?
Could you use __setitem__ instead?
Instead of this:
variable <== thing # magic happens here
can you write this?
obj.variable = thing # magic happens here
If your DSL is so different from Python that it needs new operators, perhaps you should write an interpreter for your language and run that seperately.
code = """ any syntax you like <- thing """ result = interpret(code)
Well, if python is not envisioned to be able to represent almost everything elegantly maybe I should indeed walk away from this idea. (This is sad for me ... I have been saying and believing python is envisioned that way for more than 20 years now). Your argument could be applied on PEP465 as well, where the only justification is to make matrix operation prettier. I have explained the problem of use descriptors in previous replies, where you cannot have a local signal, e.g. obj.signal = thing # works, but local_signal = thing # doesn't work.