On Mon, 29 Jun 2020 at 17:03, Joao S. O. Bueno <jsbueno@python.org.br> wrote:
If you need custom sort-orders and slicing for dicts, I've implemented
a b-tree backed mapping that can do just that a couple weeks ago - 
you are  welcome to use it:
https://github.com/jsbueno/extradict/blob/80817e75eabdde5583aa828c04beae6a20d3c4f7/extradict/binary_tree_dict.py#L354

(just "pip install extradict" ) 

It does not support numeric indexing, though - you'd need a pair of TreeDict's to do it:

```py
from extradict import TreeDict

a  = TreeDict(('abc', 'bar'), ('def', 'foo'), ('ghi', 'baz'), ('jkl', 'bam'))
a["a":"f"]
out:  ['bar', 'foo']
b = TreeDict(*((i, key) for i, key in enumerate(a)))
# Using numeric keys for range from 'a' keys:
[(key, a[key]) for key in b[1:4]]
out:
[('def', 'foo'), ('ghi', 'baz')]

```

(Meh, I was fiddling with the snippet above in thee-mail composotion and messed it -  the 
range that is output in the listing is the corresponding to b[1:3], and the lib outputs it correctly)