Add cmp() function

This commit is contained in:
Mario Baranzini 2017-08-06 23:14:41 +02:00 committed by Matthias Kuhn
parent b32212d451
commit f187c43280

View File

@ -896,3 +896,12 @@ if __name__ == "__main__":
sl = SiteList(pts)
voronoi(sl, c)
def cmp(a, b):
"""Compare the two objects x and y and return an integer according to the
outcome. The return value is negative if x < y, zero if x == y and strictly
positive if x > y.
In python 2 cmp() was a built in function but in python 3 is gone.
"""
return (a > b) - (a < b)