[issue30550] Document order-preserving dictionary output in json

Kyle Stanley report at bugs.python.org
Sun Jul 21 16:51:38 EDT 2019


Kyle Stanley <aeros167 at gmail.com> added the comment:

> OrderedDict is not recommended to preserve order any more.

> Please forget about OrderedDict unless you need additional feature OrderedDict provides.  It is far inefficient than regular dict.

Thanks for the clarification. Should this recommendation be briefly mentioned in the documentation (https://docs.python.org/3.9/library/collections.html#ordereddict-objects)? 

Currently, the docs reference that as of 3.7, the order-preserving behavior of standard dictionaries is guaranteed, but there is no mention of the significant differences in efficiency. Based on the current description, a user might end up using OrderedDictionary on the basis that they *might* have a need for reordering elements. 

If the difference in performance is significant enough, it would be worth noting in the docs so that users can take it into consideration when deciding which data structure to use.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue30550>
_______________________________________


More information about the Python-bugs-list mailing list