Re:First Impressions of Python from a Java Developer
by jonpaul on Monday November 08, 2010 @02:58PM
(#1883744)
Maybe. C# uses != and == for string comparisons. Maybe the question should be: should an immutable string class be considered primitive considering how frequently it's used despite the fact it's internally passed by ref? I guess that debate is fairly academic and not very useful. Regardless, I agree with the author's point. I don't like having to use the "equals" method in Java for strings. It feels a bit outdated.
[ Parent
| on HN ]
Re:First Impressions of Python from a Java Developer
by torme on Monday November 08, 2010 @03:07PM
(#1883773)
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.