Hacker News new | ask | show | jobs
by kstrauser 1022 days ago
You should absolutely be using `is` where appropriate. `x is None` is almost always preferable to `x == None`. If you're checking for object identity, use `is`. If equality, use `==`. They're different use cases.
1 comments

Especially since == can be overwritten, while 'is' can not.
That's right. Any class can define its own __eq__ method.