|
|
|
|
|
by derriz
1930 days ago
|
|
Am I missing something? In the paper the definition of cmp3 on page 2 seems to have a bug - as defined, wouldn't cmp3([1,2,3], [1]) return 0? # Uses 3-way cmp() for primitives
def cmp3(a, b):
if not isinstance(a, list):
global c; c += 1
return cmp(a, b)
for x, y in zip(a, b):
r = cmp3(x, y)
if r != 0:
return r
return 0
This isn't generally the expected behaviour for comparing lists, surely? |
|