> one minor problem with the six __lt__ etc is that they should be all defined. > For quick things (although I know better) I still define just __cmp__ out of > laziness. Sometime back, I proposed a mixin for this. class C(CompareMixin): def __eq__(self, other): ... def __lt__(self, other): ... The __eq__ by itself is enough to get __ne__ defined for you. Defining both __eq__ and __lt__ gets you all the rest. Raymond Hettinger ################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# #################################################################
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