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 <[email protected]> wrote:

> On Sat, Aug 1, 2020 at 10:04 AM Wes Turner <[email protected]> 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  <[email protected]>
>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/BKWWSZHVPRUIGJQQPDO2Y4KPJRBVCT2R/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to