3 ms·
> You don't think the Python way is worse? Have you considered how much familiarity might shape your reaction to the two? Both are specific patterns with arbit
by acdha 1y ago
> You don't think the Python way is worse?
Have you considered how much familiarity might shape your reaction to the two? Both are specific patterns with arbitrary restrictions which new learners have to internalize, and that’s a fairly advanced task most people won’t hit until they are familiar with the language syntax.
Here’s a counter argument: the Python methods are normal method declarations whereas C++ developers have to learn that “operator=“ means something different than what “operator =“ (or any other assignment statement) would mean, and that this is the only context where you can use those reserved symbols in method names.
To be clear, I don’t think either of these is a big deal - the concepts and usage are harder to learn than the declaration syntax – but I think it’s incredibly easy to conflate familiarity with ease of acquisition for things like this.
- thaumasiotes 1y ago> Have you considered how much familiarity might shape your reaction to the two? It doesn't. > Both are specific patterns with arbitrary restrictions which new learners have to internalize, and that’s a fairly advanced task most people won’t hit until they are familiar with the language syntax. No, the Python methods are just ordinary methods with valid names. What 'arbitrary restrictions' are you referring to?
- acdha 1y agoThe 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