We should be reading the source: https://github.com/python/cpython/blob/master/Objects/dictobject.c

AFAIU, direct subscripting / addressing was not a use case in the design phase of the current dict?

Could a __getitem__(slice_or_int_index) be implemented which just skips over the NULLs?
Or would that be no faster than or exactly what islice does when next()'ing through?

On Fri, Jul 31, 2020 at 9:14 PM Inada Naoki <songofacandy@gmail.com> wrote:
On Sat, Aug 1, 2020 at 10:04 AM Wes Turner <wes.turner@gmail.com> wrote:
> Actually, I think the reverse traversal case is the worst case because: it's not possible to use negative subscripts with islice (because that would require making a full copy).
> This doesn't work:
> >>> islice(dict.keys(), -1, -5)
> Reverse traversal did work in Python 2 but was foregone when making .keys() a view in Python 3 in order to avoid lulling users into making usually unnecessary copies.

dict is reversible now. You can do `islice(dict, 0, 5)`.

Inada Naoki  <songofacandy@gmail.com>