[Python-Dev] Why not support user defined operator overloading ?

Steven D'Aprano steve at pearwood.info
Sun Sep 29 17:33:38 CEST 2013

On Sun, Sep 29, 2013 at 08:51:37PM +0800, 张佩佩 wrote:
> Hello:
> 	As far as I know, there is not a language support user defined operator overloading.
> Python3 can overloading belowed operators.
> (Do I miss something ?)

Yes, many.


> If we can overloading these operators, why we can't overloading other operators?
> (like .* often used in matrix, U in set operation)


There is a good argument for being able to overload element-wise and 
object-wise operators. However, I don't think it is good to be able to 
create arbitrary new operators, e.g. a X b for an X operator. We 
already have syntax for arbitrary functions, and they aren't limited to 
binary operators: X(a, b, c, d, ...) works better than a X b for most 


More information about the Python-Dev mailing list