Message396972
iterating whole over the dict is O(n) where n is the historical max size of the dict.
On the other hand, there are no guarantee about `next(iter(d))` is O(1). The guarantee is O(n) at worst case. And your example is the worst case. So this is not a bug.
As Dennis wrote, we won't add doubly linked list to the dict only for this purpose.
OrderedDict is for the use case.
I don't have any better idea than bpo-32623. More ideas are welcome. |
|
Date |
User |
Action |
Args |
2021-07-05 08:23:54 | methane | set | recipients:
+ methane, rhettinger, serhiy.storchaka, Dennis Sweeney, danielfleischman |
2021-07-05 08:23:54 | methane | set | messageid: <1625473434.72.0.678414929805.issue44555@roundup.psfhosted.org> |
2021-07-05 08:23:54 | methane | link | issue44555 messages |
2021-07-05 08:23:54 | methane | create | |
|