Меня немного смущает эта логика. Когда следующее дает True в python
print('' is '') #True
print('' == '') #True
print([] == []) #True
print({} == {}) #True
Но почему эти утверждения дают False?
print([] is []) #False
print({} is {}) #False






The == operator compares the values of both the operands and checks for value equality. Whereas is operator checks whether both the operands refer to the same object or not.
https://www.geeksforgeeks.org/difference-operator-python/
Тогда почему '' is '' дает True, если сравнивает объекты?
@Vanjith: Потому что оба выражения '' оказались для одного и того же объекта. Это разрешено, но не требуется для неизменяемых объектов.
Аналогичный вопрос stackoverflow.com/questions/42553259/…