Skip to content

Commit

Permalink
Implement __lt__ as required for heapq.heapify.
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottTodd committed Dec 4, 2024
1 parent fc22312 commit 83d4a42
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ def __eq__(self, other: object) -> bool:
"""Nodes are equal only if they are the same object."""
return self is other

def __lt__(self, other):
"""Sort nodes by their memory address."""
return id(self) < id(other)


class TriePagedAttentionCacheAllocation(PageAllocation):
"""Represents a page allocation in the trie-based cache.
Expand Down

0 comments on commit 83d4a42

Please sign in to comment.