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/7F2UCQPDZ3SWSQHVPBBQQKNHVIQWKLV3/ Code of Conduct: http://python.org/psf/codeofconduct/
