> On 10 Jul 2020, at 14:08, Stestagg <[email protected]> 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/
_______________________________________________ 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/MEGK4IZYLWO6JW3ICCN72BVUHCGMAPVE/ Code of Conduct: http://python.org/psf/codeofconduct/
