[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-13 Thread Yanghao Hua
On Thu, Jun 13, 2019 at 1:02 AM Andre Roberge wrote: > > > > On Wed, Jun 12, 2019 at 7:56 PM Yanghao Hua wrote: >> >> On Wed, Jun 12, 2019 at 11:27 PM Chris Angelico wrote: >> > Yes, you would need some sort of syntactic parser. There are a couple >> > of ways to go about it. One is to make use

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-13 Thread Stephen J. Turnbull
Caleb Donovick writes: > In class bodies it is easy to redefine what assignment means, in > every other context its very annoying, I don't see why that must be > the case. It's because Python doesn't actually have assignment to variables, it has binding to names. So there's no "there" there t

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-13 Thread Kyle Lahnakoski
Correct me if I am wrong: Yanghao would like an elegant way to build graphs. Simply using << to declare the connections in the graph [1] is not an option because << is already needed for legitimate left-shift operation.  The problem is not assignment; rather, Yanghao's HDL requires more operators

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-13 Thread Stephen J. Turnbull
Kyle Lahnakoski writes: > Correct me if I am wrong: Yanghao would like an elegant way to build > graphs. Simply using << to declare the connections in the graph [1] is > not an option because << is already needed for legitimate left-shift > operation. This is his claim, yes. > The problem

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-13 Thread Greg Ewing
Kyle Lahnakoski wrote: Here is a half baked idea: class A: def assign(self, other): # whatever this means setattr(A, "<==", A.assign) Some things that would need to be addressed to fully bake this idea: * What determines the precedence of these new operators? * How to disting