0

I am looking for a list variant that automatically keeps the values sorted. Does Python have a thing like OrderedList readily available?

If not, are there recommended alternatives?

codeforester
  • 34,080
  • 14
  • 96
  • 122
  • 2
    `list` objects are already ordered like `OrderedDict`... *by insertion order*. You want something that maintains *sorted order*, that's entirely different. Python does not provide that, no.... but you probably just want to use the library [`sortedcontainers`](http://www.grantjenks.com/docs/sortedcontainers/) that provides various drop-in replacements for Python data types that maintain sorted order – juanpa.arrivillaga Jul 21 '20 at 00:17
  • 1
    http://www.grantjenks.com/docs/sortedcontainers/ – Barmar Jul 21 '20 at 00:18

0 Answers0