3 ms·
Python: Why Operator “is” and “==” Are Sometimes Interchangeable For Strings?
- dalke 12y agoSummary: Don't ever use 'is' as a substitute for '==' with Python strings. They are never interchangeable except as an implementation detail which is subject to change. As a suggestion to yiedyie, please don't link to a S.O. question marked as "duplicate", especially where the primary questions have answers which are more informative. Also, I see that you post a lot of links to S.O. using a S.O. id of '1577343', rather than point to the generic URL for the question. This makes me think your main goal is to get karma points on S.O. rather than point to something which you really think is interesting. I generally ignore those links. When I see low-quality questions like this one I often flag them. While I don't know if that's a general trend of other HN readers, you may want to take that information into account when you decide which S.O. links to post.