3 ms·
The arbitrary restriction is that you have to just learn a specific pattern and follow it. I can’t have my Python class use “addition” if I hate underscores or
by acdha 1y ago
The arbitrary restriction is that you have to just learn a specific pattern and follow it. I can’t have my Python class use “addition” if I hate underscores or my C++ code use “mathematical_division” if I’m horribly pedantic. In both cases, it’s just a particular design decision by the language developers I have to learn, and in both cases I won’t think much of it after the initial acclimation.
- yunwal 1y agoPython you have to learn something arbitrary for each dunder method you want to define/override. + —> __add__, * —-> __mul__, etc C++ it’s just one pattern to learn, x -> operatorx