New submission from Alexander Belopolsky: Consider the following code:
$ cat x.py from collections import OrderedDict class X: def items(self): print('items') return [] def keys(self): print('keys') return [] print(dict(X())) print(OrderedDict(X())) When I run it under python 3.4, I get $ python3.4 x.py keys {} keys OrderedDict() but under python 3.5, I get $ python3.5 x.py keys {} items OrderedDict() Under 3.4 both dict and OrderedDict constructors call the keys() method of the underlying object (and then call __getitem__ repeatedly if keys() returns a non-empty list), but in 3.5 OrderedDict behavior changed and it calls the values() method instead. ---------- keywords: 3.4regression messages: 270842 nosy: belopolsky priority: normal severity: normal status: open title: An unexpected difference between dict and OrderedDict type: behavior versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27576> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com