Skip to content

Instantly share code, notes, and snippets.

@donaldpminer
Created April 26, 2014 18:44
Show Gist options
  • Save donaldpminer/11327755 to your computer and use it in GitHub Desktop.
Save donaldpminer/11327755 to your computer and use it in GitHub Desktop.
class _SlowList(list):
# this really needs to be replaced by something... not... slow.
def append(self, item):
# appends, then sorts the list
list.append(self, item)
list.sort(self)
def extend(self, items):
list.extend(self, items)
list.sort(self)
def index(self, item):
# change default behavior to be binary search
return _binary_search(self, item)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment