Barry writes: > Using == for identity objects is the wrong thing. We should discourage > tests like "if obj == None" in favor of "if obj is None". I hear you, but I disagree. There is a good reason why the default implementation of '==' compares by object identity. I don't care much whether we use "if obj is None" rather than "if obj == None", since the PARTICULAR case of comparing with None is mostly just an idiom. But if you have two different identity objects and want to compare them, then I would prefer if currentCustomer == desiredCustomer: to if currentCustomer is desiredCustomer: However, either one works, and I won't gripe about your using 'is' if you prefer it. I _WOULD_ gripe if you overrode __eq__ to raise an exception in order to force me to use 'is' not '==' on your objects (not that you ever suggested doing so). -- Michael Chermside
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4