On 2013-09-29, at 14:51 , 张佩佩 wrote: > Hello: > As far as I know, there is not a language support user defined operator overloading. > Python3 can overloading belowed operators. > - negated > + unchanged > > - minus > + add > * multiplication > / division > // true division > % remainder > ** power > (Do I miss something ?) ~ invert (unary) () call . get attribute [] get item << left shift >> right shift & binary and ^ xor | binary or And the inplace versions of most of these can be implemented separately, which can probably be counted as supplementary operators. > > If we can overloading these operators, why we can't overloading other operators? > (like .* often used in matrix, U in set operation) This is more of a python-ideas subject. And one of the reasons likely is that it would require significantly reworking the grammar to handle a kind of user-defined opname (similar to name, but for operator tokens), with user-defined priority and associativity, and the ability to import operators (or define how and when operators become available compared to their definition) That's a huge amount of complexity with little to gain.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4