4 ms·
`is` is more like doing this in C: char* s1 = "wtf!"; char* s2 = "wtf!"; if (s1 == s2) { ... } They may or may not be stored in the same place depending
by Jtsummers 1y ago
`is` is more like doing this in C:
char* s1 = "wtf!";
char* s2 = "wtf!";
if (s1 == s2) { ... }
They may or may not be stored in the same place depending on your compiler (clang and gcc yes, msvc no, at least with just a quick default build). If you actually want to do an equality check, you need to use `==` (in Python) which would be like using `strcmp` in C.
> "wtf!" not being equal to itself
It is equal to itself, but multiple variables referencing that string may not hold references to the same (literal, in memory) string.