Advertisement
ccrr10

Comparing objects

Dec 7th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. >>> x, y = 2 ** 5, 2 ** 5
  2. >>> x == y
  3. True
  4. >>> x is y
  5. True
  6. >>> id(x), id(y)
  7. (9063616, 9063616)
  8. >>> x, y = 2 ** 1000, 2 ** 1000
  9. >>> x is y
  10. False
  11. >>> id(x), id(y)
  12. (140501874197648, 140501874199728)
  13. >>> x is y
  14. False
  15. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement