Skip to content

Add OrderedDict.move_to_end #4408

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

Closed
tannewt opened this issue Mar 15, 2021 · 0 comments · Fixed by #8258
Closed

Add OrderedDict.move_to_end #4408

tannewt opened this issue Mar 15, 2021 · 0 comments · Fixed by #8258
Labels
cpython api modules from cpython enhancement good first issue Hacktoberfest Beginner friendly issues for Hacktoberfest event help wanted
Milestone

Comments

@tannewt
Copy link
Member

tannewt commented Mar 15, 2021

API doc is here: https://docs.python.org/3/library/collections.html#collections.OrderedDict.move_to_end

Code would be added to: https://github.com/adafruit/circuitpython/blob/main/py/objdict.c#L563 It'll need a separate locals so that move_to_end isn't added for regular dictionaries.

This will fix adafruit/Adafruit_CircuitPython_BLE_BroadcastNet#18

@tannewt tannewt added this to the Long term milestone Mar 15, 2021
@adafruit-adabot adafruit-adabot added the Hacktoberfest Beginner friendly issues for Hacktoberfest event label Oct 26, 2021
@FoamyGuy FoamyGuy removed the Hacktoberfest Beginner friendly issues for Hacktoberfest event label Nov 8, 2021
@adafruit-adabot adafruit-adabot added the Hacktoberfest Beginner friendly issues for Hacktoberfest event label Sep 29, 2022
jepler added a commit to jepler/circuitpython that referenced this issue Aug 4, 2023
this implementation is hoped to be smaller. (feather_m4_express/fr fits
unlike the other PR; approximate savings ~600 bytes)

Minor difference to standard Python: A `dict` object has a
`move_to_end` method. However, calling this method always results in
TypeError.

Implementing it this way means that the method table can still be shared
between OrderedDict and builtin dict.

Closes adafruit#4408.
jepler added a commit to jepler/circuitpython that referenced this issue Aug 4, 2023
this implementation is hoped to be smaller. (feather_m4_express/fr fits
unlike the other PR; approximate savings ~600 bytes)

Minor difference to standard Python: A `dict` object has a
`move_to_end` method. However, calling this method always results in
TypeError.

Implementing it this way means that the method table can still be shared
between OrderedDict and builtin dict.

Closes adafruit#4408.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpython api modules from cpython enhancement good first issue Hacktoberfest Beginner friendly issues for Hacktoberfest event help wanted
Projects
None yet
3 participants