[Python] ‘is’ 跟 ‘==’




‘is’ 比較的是 identity,’==’ 比較的是 equality。

“obj1 is obj2” 等同於 “id(obj1) == id(obj2)”。

參考資料:




Be the first to comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.