strictyaml icon indicating copy to clipboard operation
strictyaml copied to clipboard

Use only ordinary dicts in python >= 3.7

Open crdoconnor opened this issue 5 years ago • 1 comments

Starting in python 3.7 all dicts are guaranteed to maintain order:

https://mail.python.org/pipermail/python-dev/2017-December/151283.html

OrderedDict is thus unnecessary, although still necessary for any version of python below 3.7.

Drawbacks

  • Backwards compatibility: if type(parsed) used to get OrderedDict then upgrades of python may subsequently fail.
  • ???

Benefits

  • repr of a dict looks a bit nicer
  • ???

crdoconnor avatar Oct 05 '19 15:10 crdoconnor

Backwards compatibility: if type(parsed) used to get OrderedDict then upgrades of python may subsequently fail.

Combining with issue #90 ("Support for type hints"): returning dict for load(..., List[Dict]) and OrderedDict for load(..., Seq(Map())) would be backwards compatible.

opk12 avatar Mar 30 '20 06:03 opk12