On 7/26/2018 4:12 AM, Miro Hrončok wrote:
Hi,
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')])
To:
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.
Thoughts?
On python-idea, Miro Hrončok asked today whether we can change the OrderedDict repr from, for instance, OrderedDict([('a', '1'), ('b', '2')]) # to OrderedDict({'a': '1', 'b': '2'}) I am not sure what our repr change policy is, as there is a back-compatibility issue but I remember there being changes. -- Terry Jan Reedy