Все вопросы: [object-comparison]
4 вопросов
Python: Why does ("hello" is "hello") evaluate as True?
Why does "hello" is "hello" produce True in Python? I read the following here: If two string literals are equal, they have been put to same memory location. A string is an immutable entity. No harm can be done. So there is one and only one place in memory for every Python string? Sou...
What happens when you compare two objects?
If I wrote an operator == for class Foo (in C++), what happens, exactly? Does it compare each data member against each other? class Foo { private: int bar; public: bool operator==(const Foo other&) { return *this == other; //what? //is this the sam...
Сравнение объектов в JavaScript
Как лучше всего сравнивать объекты в JavaScript? Пример: var user1 = {name : "nerd", org: "dev"}; var user2 = {name : "nerd", org: "dev"}; var eq = user1 == user2; alert(eq); // gives false Я знаю, что два объекта равны, если они относятся к одному и тому же объекту , но есть ли спосо...
Почему мой оператор сравнения if не работает?
Почему следующий код (в какао) не работает? NSString *extension = [fileName pathExtension]; NSString *wantedExtension = @"mp3"; if(extension == wantedExtension){ //work } в Xcode это просто выполняется без предупреждений или ошибок, но не делает того, что, как я думаю, ДОЛЖНО делать.