[issue27576] An unexpected difference between dict and OrderedDict

2016-09-09 Thread Eric Snow
Changes by Eric Snow : -- resolution: -> fixed stage: needs patch -> resolved status: open -> closed ___ Python tracker ___ ___ Pytho

[issue27576] An unexpected difference between dict and OrderedDict

2016-09-09 Thread Eric Snow
Eric Snow added the comment: Thanks for pointing this out, Alexander. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue27576] An unexpected difference between dict and OrderedDict

2016-09-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 70758c12e888 by Eric Snow in branch 'default': Issue #27576: Fix call order in OrderedDict.__init__(). https://hg.python.org/cpython/rev/70758c12e888 -- nosy: +python-dev ___ Python tracker

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-30 Thread Xiang Zhang
Xiang Zhang added the comment: After totally studying OrderedDict, I get a better understanding of what Serhiy means. So although we can get a better performance for dict, it's not needed at all. Remove the v3 patch. -- ___ Python tracker

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-30 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file43902/odict_update_v3.patch ___ Python tracker ___ ___ Python-bugs-list mail

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-26 Thread Xiang Zhang
Xiang Zhang added the comment: I write a new version restoring the fast path for dict. It now uses PyDict_Next and seems to be much faster than the path using keys. [cpython]$ ./python -m timeit -s 'from collections import OrderedDict; d = {"a":1,"c":2,"b":3,"d":4}' 'OrderedDict(d)' 100 lo

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-25 Thread Xiang Zhang
Xiang Zhang added the comment: I didn't think about order. I just thought using concrete API may be faster. But after your comment, I tested the performance and it seems PyDict_Items makes it much slower (it does more work, eg, make tuples). So I agree it is not needed at all. -- Adde

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think this case (fast path for exact dict) is not needed at all. Exact dict is not ordered, and OrderedDict created from exact dict has nondetermined order (unless a dict has size 0 or 1). -- nosy: +serhiy.storchaka ___

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-25 Thread Xiang Zhang
Xiang Zhang added the comment: Submit a patch to fix this. Hope it helps. -- keywords: +patch nosy: +xiang.zhang Added file: http://bugs.python.org/file43876/odict_update.patch ___ Python tracker __

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-20 Thread Alakshendra Yadav
Changes by Alakshendra Yadav : -- nosy: +alakyadav ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: This does need to be fixed. FWIW, here is the relevant docstring from MutableMapping: ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k]

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-19 Thread Emanuel Barry
Changes by Emanuel Barry : -- assignee: -> eric.snow components: +Library (Lib) keywords: +3.5regression -3.4regression nosy: +ebarry, eric.snow stage: -> needs patch ___ Python tracker __

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-19 Thread Alexander Belopolsky
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