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

Rhodri James rhodri at kynesim.co.uk
Tue Jun 4 09:00:34 EDT 2019


On 04/06/2019 13:36, Yanghao Hua wrote:
> On Tue, Jun 4, 2019 at 2:20 PM Rhodri James<rhodri at kynesim.co.uk>  wrote:
>> On 04/06/2019 11:06, Yanghao Hua wrote:
>>> [...]  what I needed is an operator that does not
>>> collide with all existing number/matrix operators.
>> Why?
>>
>> That's the question that in all your thousands of words of argument you
>> still haven't answered beyond "because I want it."
> Rhodri, I don't know how could I be more specific, help me out here:
> 
> signal << (signal << 2) --> the first >> means "assign" and the second
> means shift? Do you really think this is readable? Or maybe you have a
> better idea I am not aware of?

I'm asking why you want the first "assignment" << *at all*.  What is it 
about the operation you are doing (which, incidentally, I still don't 
get) that makes it *so much* better at expressing what you're doing than 
(say) a method call?  What's wrong with

   signal.suitable_descriptive_verb(signal << 2)

The bar for adding a new operator is intentionally high, and I haven't 
seen enough justification to satisfy me yet.  Everyone will need to be 
able to read this and get your intention, don't forget.

-- 
Rhodri James *-* Kynesim Ltd


More information about the Python-ideas mailing list