python-sortedcontainers icon indicating copy to clipboard operation
python-sortedcontainers copied to clipboard

Feature request: update element key

Open kaber2 opened this issue 4 years ago • 1 comments
trafficstars

For SortedKeyList, it would be nice to have a more optimized way of updating an item's key than doing remove + add.

A few things that come to mind would be:

  • determining whether there is no position change and in that case do nothing
  • searching only maxes before/after the changed element for the new insertion point
  • avoiding list shrinking and enlargement if the element will end up in the same sublist

kaber2 avatar Nov 21 '21 13:11 kaber2

These are good ideas and I’ve thought about it before. Can you propose an API as one or more methods to support?

grantjenks avatar Nov 21 '21 15:11 grantjenks