New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save OrderedDict imports in various stdlibs. #76541
Comments
csv and re has issues already. This is typing: unittest/util.py enum.py lib2to3/pgen2/grammar.py asyncio/base_events.py configparser.py inspect.py json/tool.py json/__init__.py
31: >>> from collections import OrderedDict
32: >>> mydict = OrderedDict([('4', 5), ('6', 7)])
290: collections.OrderedDict will remember the order of insertion). If
318: collections.OrderedDict will remember the order of insertion). If json/decoder.py email/_header_value_parser.py pydoc_data/topics.py |
These should be looked at one at a time (no sweeping search and replace missions). The original author should be consulted when possible (they are in a better position to judge whether the original intent was preserved). Published APIs should not be changed (i.e. you can't just change the default argument for configparser). Docs should be changed carefully (i.e. let Bob Ippolito decide whether he wants to change the examples of how to use the object_pairs_hook). Guido was very clear that you can't just downgrade every occurrence of OrderedDict with dict. Please don't be so aggressive (grepping every occurrence in the standard library without giving it individual consideration). |
Agreed. |
Let's remove from these:
I don't touch other modules. |
I concur with Raymond. I made the same searching before and have found that there are not much opportunities for getting rid of OrderedDict and there are even less cases that will get a benefit from this. |
All of these modules have active maintainers. You should create separate issues for each one of these and assign to those maintainers. You don't just get to mow down all the other developers. That isn't how we work together. In the JSON module, there does need to be an example of how to use object_pairs_hook, so you will need to come up with a replacement or an additional note explaining in Py3.7 and later, most of the OrderedDict use cases have been supplanted by the regular dict. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: