The error from "file" != b"file" is particularly bad. It makes sense if you realise that a == b means a,b have the same type and their values are equal. But there is no way a even a reasonably careful programmer could spot this without super careful testing (and who’s to say they would remember to test b"file" and not "file"). Other ways this could be solved are:
1. String == bytes is true iff converting the string to bytes gives equality (but then can == become non transitive)
2. String == bytes raises (and so does string == string if encodings are different)
3. Type-specific equality operators like in lisp. But these are ugly and verbose which would discourage their use and so one would not think to use bytesEqual instead of ==
4. A stricter/looser notion of equality that behaves as one of the above called eg === but this is also not great