Remove and return value at `index` in sorted set. Raise :exc:`IndexError` if the sorted set is empty or index is out of range. Negative indices are supported. Runtime complexity: `O(log(n))` -- approximate. >>> ss = SortedSet('abcde') >>> ss.pop()
(self, index=-1)
| 425 | |
| 426 | |
| 427 | def pop(self, index=-1): |
| 428 | """Remove and return value at `index` in sorted set. |
| 429 | |
| 430 | Raise :exc:`IndexError` if the sorted set is empty or index is out of |
| 431 | range. |
| 432 | |
| 433 | Negative indices are supported. |
| 434 | |
| 435 | Runtime complexity: `O(log(n))` -- approximate. |
| 436 | |
| 437 | >>> ss = SortedSet('abcde') |
| 438 | >>> ss.pop() |
| 439 | 'e' |
| 440 | >>> ss.pop(2) |
| 441 | 'c' |
| 442 | >>> ss |
| 443 | SortedSet(['a', 'b', 'd']) |
| 444 | |
| 445 | :param int index: index of value (default -1) |
| 446 | :return: value |
| 447 | :raises IndexError: if index is out of range |
| 448 | |
| 449 | """ |
| 450 | # pylint: disable=arguments-differ |
| 451 | value = self._list.pop(index) |
| 452 | self._set.remove(value) |
| 453 | return value |
| 454 | |
| 455 | |
| 456 | def remove(self, value): |