[Python-ideas] Change repr of collections.OrderedDict to be more dict-like

Miro Hrončok mhroncok at redhat.com
Thu Jul 26 04:12:01 EDT 2018


now when dicts are sorted, can we change the repr of 
collections.OrderedDict to look like dict?

I mean from:

     OrderedDict([('a', '1'), ('b', '2')])


     OrderedDict({'a': '1', 'b': '2'})

I assume the current list-of-tuples repr is there so copy pasting the 
repr to the interpreter results in the same OrderedDict. When dicts 
preserve insertion order, this now works with dict.

I consider the dict-based repr much easier to read.

Miro Hrončok
Phone: +420777974800
IRC: mhroncok

More information about the Python-ideas mailing list