Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

'No guarantee of order' section in dictionaries notebook #42

Open
matt-graham opened this issue May 24, 2022 · 0 comments · May be fixed by #47
Open

'No guarantee of order' section in dictionaries notebook #42

matt-graham opened this issue May 24, 2022 · 0 comments · May be fixed by #47
Assignees

Comments

@matt-graham
Copy link
Contributor

matt-graham commented May 24, 2022

The 01-beginner/028dictionaries.ipynb notebook currently has the following example

No guarantee of order

Another consequence of the way dictionaries work is that there's no guaranteed order among the elements:

my_dict = {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4}
print(my_dict)
print(my_dict.values())

which is not correct for Python 3.7+ which guarantees that dictionaries retain insertion order. We should either remove this example entirely or perhaps create a similar example for sets for which this behaviour still applies.

@matt-graham matt-graham self-assigned this May 24, 2022
@matt-graham matt-graham linked a pull request Oct 27, 2022 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant