Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

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

@matt-graham

Description

@matt-graham

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions