classification
Title: csv.DictReader can return basic dict instead of OrderedDict
Type: performance Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, rhettinger, selik
Priority: normal Keywords: patch

Created on 2018-06-29 19:47 by selik, last changed 2019-02-01 03:02 by rhettinger. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8014 merged selik, 2018-06-29 19:59
Messages (6)
msg320734 - (view) Author: Michael Selik (selik) * Date: 2018-06-29 19:47
Since dicts are now keeping insertion order as of 3.7, we can switch to the more efficient construction of dict rather than OrderedDict for each row in the CSV file.
msg320735 - (view) Author: Michael Selik (selik) * Date: 2018-06-29 19:59
Pull request.

https://github.com/python/cpython/pull/8014
msg320739 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-06-29 20:55
The dict and OrderedDict APIs are slightly different, although I'm not sure anyone cares. See #32339. In that PR https://github.com/python/cpython/pull/4904, Guido said to not make this change. See also the python-dev discussion at https://mail.python.org/pipermail/python-dev/2017-December/151351.html

If you feel strongly about this, I suggest discussing it on python-dev first.
msg320741 - (view) Author: Michael Selik (selik) * Date: 2018-06-29 21:13
I searched for previously submitted issues, but somehow didn't spot #32339.

I'll do some searching for whether anyone uses ``move_to_end`` on DictReader rows and respond to the mailing list with a report.
msg320748 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2018-06-30 00:50
This might need a deprecation before switching but it would be useful.  The DictReader can produced huge numbers of instances that would benefit from the smaller size.
msg334613 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-01-31 08:47
New changeset 9f3f0931cfc58498086d287226650599a97412bb by Raymond Hettinger (Michael Selik) in branch 'master':
bpo-34003: Use dict instead of OrderedDict in csv.DictReader (GH-8014)
https://github.com/python/cpython/commit/9f3f0931cfc58498086d287226650599a97412bb
History
Date User Action Args
2019-02-01 03:02:18rhettingersetresolution: not a bug -> fixed
2019-02-01 03:02:05rhettingersetstatus: open -> closed
resolution: not a bug
stage: patch review -> resolved
2019-01-31 08:47:55rhettingersetmessages: + msg334613
2018-06-30 00:50:21rhettingersetnosy: + rhettinger
messages: + msg320748
2018-06-29 21:13:07seliksetmessages: + msg320741
2018-06-29 20:55:06eric.smithsetnosy: + eric.smith
messages: + msg320739
2018-06-29 20:02:17seliksettype: performance
2018-06-29 20:02:00seliksetcomponents: + Library (Lib)
2018-06-29 19:59:52seliksetmessages: + msg320735
2018-06-29 19:59:33seliksetkeywords: + patch
stage: patch review
pull_requests: + pull_request7622
2018-06-29 19:47:39selikcreate