Created
November 9, 2016 07:37
-
-
Save mKaloer/d20d827d37887a3fa8ff7bce5aa6299c to your computer and use it in GitHub Desktop.
Python implementation of comparison algorithm for SQL Server GUID (uniqueidentifier)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def less_than_guid(a,b): | |
""" | |
This implements the weird comparison method for sql server | |
GUID. | |
""" | |
groups = [slice(10,16), slice(8,10), slice(6,8), slice(4,6), slice(0,4)] | |
for g in groups: | |
if a.bytes[g] < b.bytes[g]: | |
return True | |
elif a.bytes[g] > b.bytes[g]: | |
return False | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment