+1 on (lazy) Sequence views optimized for sequential reads and random access (which hide the dict implementation which varies across which platforms?)

I'm somewhat indifferent on the name:

# Sequence views names:
## method() -> Sequence
- orderedkeys(), orderedvalues(), ordereditems()
- okeys(), ovalues(), oitems()
- keys(), keysordered(), values(), valuesordered(), items(), itemsordered()
  - What does this do with tab-completion?

# Get key, value, item by integer-location method names:
## method(start: int, stop: int, step: int) -> Any
- keys_iloc(), values_iloc(), items_iloc()

## __getitem__(slice_or_int: Union[slice, int]) -> Any
- keys[0], values.iloc[1:4:2], items.iloc[1:4, 2:3]
- keys_iloc[], values_iloc[], items_iloc[] 
- keysiloc[], valuesiloc[], itemsiloc[]
- keys.iloc[], values.iloc[], items.iloc[]
- keypos(),

## method(index: int) -> Any:
- getkey(), getvalue(), getitem(

# Get integer-location of a key, of a value:
## method(value) -> int, method(value) ->
- index(value)
  - this is compatible with list.index and str.index but incompatible with Series/Dataframe.index (which may or may not be irrelevant)
- orderedkeys.index(), orderedvalues.index()
- okeys.index(), ovalues.index()
- keys.ordered.index(), values.ordered.index()

- getkeypos(), getvaluepos()
- getkeyiloc(), getvalueiloc()


- what did i miss?
- is there an opportunity to optimize performance of e.g getvaluepos() / values.ordered.index()?
- performance considerations between islice(dict_view) and Sequence.__getitem__?

On Fri, Jul 31, 2020 at 11:17 AM Ricky Teachey <ricky@teachey.org> wrote:
On Fri, Jul 31, 2020 at 10:31 AM Guido van Rossum <guido@python.org> wrote:
So maybe we need to add dict.ordered() which returns a view on the items that is a Sequence rather than a set? Or ordereditems(), orderedkeys() and orderedvalues()?

I for one would be +1 on this idea.

On the bike shed hew: oitems(), okeys(), and ovalues() would be much shorter, and shouldn't be too difficult to read once they get established (though i am sure many will differ on this point).


"I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler