Skip to content

CLN: OrderedDict -> Dict #29923

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

Merged
merged 8 commits into from
Dec 1, 2019
Merged

CLN: OrderedDict -> Dict #29923

merged 8 commits into from
Dec 1, 2019

Conversation

alimcmaster1
Copy link
Member

@alimcmaster1 alimcmaster1 commented Nov 29, 2019

As of CPython 3.6 the implementation of dict maintains insertion order.

This became a language feature in python 3.7.

Note in python 3.8 support for reversed(dict) was added - but we don't seem to use that in the use cases i've eliminated.

There is more to do here.

@topper-123
Copy link
Contributor

Can you use dict literals where possible, i.e. {"": (0, 0)} dict((("", (0, 0)),)) etc.

Else LGTM.

@topper-123 topper-123 added this to the 1.0 milestone Nov 29, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Should maybe add a code check as well to not use OrderedDict, or is there any outstanding reason still to use?

@jreback

@jreback
Copy link
Contributor

jreback commented Nov 29, 2019

@alimcmaster1 yeah lgtm. but agree we need a code check here, can you add.

@alimcmaster1
Copy link
Member Author

Thanks @topper-123 updated as per your comments. @jreback sure will add a code check in a follow up - there are still some more references to remove but ill save those for next PR

@@ -2992,7 +2991,7 @@ def _write_map(self):
the map with 0s. The second call writes the final map locations when
all blocks have been written."""
if self._map is None:
self._map = OrderedDict(
self._map = dict(
(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A last one missing here, else looks good.

@WillAyd WillAyd merged commit 4e33ba0 into pandas-dev:master Dec 1, 2019
@WillAyd
Copy link
Member

WillAyd commented Dec 1, 2019

Thanks @alimcmaster1

proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
@alimcmaster1 alimcmaster1 deleted the mcmali-noordered-dict branch December 25, 2019 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants