On 10 Jul 2020, at 14:08, Stestagg <stestagg@gmail.com> wrote:


Adding indexing to views adds another requirement to the dict implementation:

Yes, that's the proposed change
 
indexing for sequences at least suggests that access is O(1).
That makes it impossible to use, as an example, a linked list to preserve insertion order.

 The docs for the Sequence abc explicitly talk about situations where index is not O(1), and say that while not ideal, this is valid (mentioning linked-lists by name).

Its a quality of implementation issue.  A sequence where item access is not O(1) is not invalid, but surprising and likely to cause performance problems because users tend to expect that item access is O(1).


The current existing `dict` implementation does not support O(1) index lookup from a view, (as discussed previously), so a change to linked-lists would not change this runtime O characteristic.

The current views don’t support indexing at all, that’s the whole point of this thread.

Ronald


Twitter / micro.blog: @ronaldoussoren
Blog: https://blog.ronaldoussoren.net/