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

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


On 26.7.2018 10:24, Grégory Lielens wrote:
> I would wait a little bit. OrderedDict will probable become a pure 
> synonym for dict,
> in a few releases, and the repr issue will solve itself, both giving the 
> even simpler/nicer {'a': '1', 'b': '2'}
> 
> Your proposal expose that dicts are ordered (which they are, but it's 
> hidden). Once exposed, OrderedDict are obsolete and should be in the 
> namespace only for backward compatibitlity.

I don't agree. See this thread:

https://mail.python.org/pipermail/python-dev/2018-July/154765.html

Namely:

On 26.7.2018 05:23, INADA Naoki wrote:
 > No.  There are some major difference.
 >
 > * d1 == d2 ignores order / od1 == od2 compares order
 > * OrderedDict has move_to_end() method.
 > * OrderedDict.pop() takes `last=True` keyword.

-- 
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok


More information about the Python-ideas mailing list