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. http://docs.python.org/3/reference/datamodel.html#special-method-names http://docs.python.org/3/reference/datamodel.html#emulating-numeric-types > If we can overloading these operators, why we can't overloading other > operators? > (like .* often used in matrix, U in set operation) http://www.python.org/dev/peps/pep-0211/ http://www.python.org/dev/peps/pep-0225/ 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 uses. -- Steven _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com