[Subject fixed] [Tim shows there's a lot left to the imagination when trying to glean the meaning of list1==list2 using rich comparisons.] I would like to break this down by defining the mapping between cmp() and rich comparisons. I propose: - If cmp() is requested but not defined, and rich comparisons are defined, try ==, <, > in order; if all three yield false, act as if rich comparisons were not defined, and use the fallback comparison (i.e. by address). - If a rich comparison is requested but not defined, use cmp() and use the obvious mapping. - Continue to define the comparison of unequal sequences in terms of cmp(). - Testing == or != for sequences takes these shortcuts: 1. if the lengths differ, the sequences differ 2. compare the elements using == until a false return is found Note that this defines 'x!=y' as 'not x==y' for sequences. We could easily go the extra mile and define != to use only != on the items; but is this worth the extra complexity? --Guido van Rossum (home page: http://www.python.org/~guido/)
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