Skip to content
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

consider making a defaultdict-like wrapper for OrderedDict #7311

Closed
cosmicexplorer opened this issue Mar 5, 2019 · 1 comment
Closed

consider making a defaultdict-like wrapper for OrderedDict #7311

cosmicexplorer opened this issue Mar 5, 2019 · 1 comment
Assignees

Comments

@cosmicexplorer
Copy link
Contributor

In #7116 we add union rules to the RuleIndex, which involves manually checking if an entry is in an OrderedDict, and if so initializing it. It doesn't seem super hard to make a quick wrapper type which would do this if this is something we end up doing more often with OrderedDicts. It's possible this technique could be generalized to other collections.

@jsirois
Copy link
Contributor

jsirois commented Jun 8, 2020

I'm going to close this since defaultdict is documented as extending dict and even though in Python 3.6 dict preserving insertion order is a CPython implementation detail, we are wedded to CPython via Rust FFI so we can rely on this detail in Python 3.6. We no longer have to worry about this in Python 3.7+ where dict is documented as preserving insertion order.

@jsirois jsirois closed this as completed Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants