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

Terry Reedy tjreedy at udel.edu
Sat May 25 13:31:17 EDT 2019


On 5/24/2019 4:25 PM, Yanghao Hua wrote:
> On Fri, May 24, 2019 at 5:45 PM Terry Reedy <tjreedy at udel.edu> wrote:
>> What I understand is that you are doing discrete-time hardware
>> simulation and that you need a operator that will schedule future
>> assigments to int-like objects.  Have you considered using '@' to do
>> that?  int @ int-expression is currently invalid, so defining it will
>> not interfere with other int operations.  What am I not understanding?
> 
> I am not sure if I understood this. The intention is to e.g. assign a
> signal with a value in a nature way, e.g. signal <== 5, are you saying
> to replace <== with @?

That is what i meant, but reading

 > I really really would like either a equal sign

suggests '@=' as a better alternative.  (I am not sure if the 
implementation would be equally easy or hard.)  How does 'signal @= 5' look?

Either is pragmatic in that these exist since a few versions ago, and 
cannot interfere with existing integer expressions, rather than in the 
far very hypothetical future.

 > not really intuitive though

'@' means 'at' and you want to make the assignment 'at the next time 
mark' (or whatever you call it). This is more intuitive to me than 
seeing '@' as 'matrix-multiply' because 'matrix' contains 'at'.

When we added @, it was known and intended that it could serve other 
then unknown uses.

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list