Section 12.1 Dictionaries: As of Python 3.7, dictionaries are ordered.
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- python
- Domain
- documentation
Research direction
Start with Section 12.1 on the linked dictionaries_dictionaries.html page and locate its source in the repository. Compare the statements about dictionary ordering with the Python 3.7 documentation, then clarify whether each passage describes generic maps or Python dictionaries. Update the relevant wording and verify the rendered section and any nearby references.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
Yes, there is some unclear/vague language around dictionaries being ordered/unordered. In Section 12.1, second paragraph, the book reads:
"Dictionaries are a different kind of collection. They are Python’s built-in mapping type. A map is an unordered, associative collection. The association, or mapping, is from a key, which can be any immutable type, to a value, which can be any Python data object."
The bold text is vague. Maps (not in Python, but the generic hash map or hash table which Python dictionaries are built upon) are unordered, making this statement true. However, dictionaries are a slightly different implementation of hashmaps, which has been ordered as of Python 3.7:
"the insertion-order preservation nature of dict objects has been declared to be an official part of the Python language spec."
The chapter goes on to discuss this unordered nature, which is now also false (it may also appear in later sections, but I did not comb them all):
"The order of the pairs may not be what you expected. Python uses complex algorithms, designed for very fast access, to determine where the key-value pairs are stored in a dictionary. For our purposes we can think of this ordering as unpredictable."
The order will always be insertion-ordered now, and is predictable.
Describe the solution you'd like
Either clarification of when the book is a) describing a generic hashmap/hashtable/map, or a specific Python dictionary; or b) removal of the language about dictionaries being unordered. I believe the former is a better solution, as it will matter to students after this introduction to Python, such as when they learn hash tables in a Data Structures course.
Additional context
Link to the exact text
- Dominant language
- HTML
- Stars
- 135
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RunestoneInteractive/thinkcspy
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
RunestoneInteractive/thinkcspy#279 · 4 comments ·
-
bug help wanted
Difficulty 3/5 1-2 days Newbie friendliness 35/100
RunestoneInteractive/thinkcspy#278 · 6 comments ·
-
enhancement
RunestoneInteractive/thinkcspy#277 · 1 comment · 1 assignee ·
-
The "Expected" and "Actual" labels on autograded assertions for ActiveCode exercises are backwards Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
RunestoneInteractive/thinkcspy#276 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
All issues in RunestoneInteractive/thinkcspy
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·