5 ms·
Agreed. Thinking about it now, I would rather the inverse in a language be true, and have == be used for value comparison, and have a more wordy function for r
by torme 16y ago
Agreed.
Thinking about it now, I would rather the inverse in a language be true, and have == be used for value comparison, and have a more wordy function for reference comparison. In my experience, I feel that its a much more common usage, and would probably reduce errors caused by programmers choosing the wrong operator. The only downside to this is that you then have to override an operator if you want to change equality comparison, instead of a function.
- Xuzz 16y agoPython has == for value, and 'is' for reference -- that seems like a good solution to me, since it works for both "primitive" and "complex" data structures.
- Xuzz 16y agoPython has == for value, and 'is' for reference -- that seems like a good solution to me, since it works for both "primitive" and "complex" data structures.