Skip to content

01-short-introduction-to-Python.md: remove statement about order in Python dicts#380

Merged
wrightaprilm merged 1 commit intodatacarpentry:gh-pagesfrom
maxim-belkin:python-dict-fix1
May 27, 2019
Merged

01-short-introduction-to-Python.md: remove statement about order in Python dicts#380
wrightaprilm merged 1 commit intodatacarpentry:gh-pagesfrom
maxim-belkin:python-dict-fix1

Conversation

@maxim-belkin
Copy link
Copy Markdown
Contributor

I suggest removing the statement about the order in Python dictionaries. The behavior has changed between Python 3.5, 3.6, and 3.7 and it would be a bit too difficult to explain.

The order in Python dictionaries is a delicate issue and is too complex
to describe to a novice learner correctly. Statement that the order in
which key-value pairs are returned in a 'for' loop is not guaranteed, on
the other hand, is no longer correct. We could say
that some "order-dependent" functions do not apply to the
classical Python dictionaries (e.g., reversed, move_to_end), but that
would be an overkill. I think that deleting this statement might
be the best course of action at this moment.
@maxim-belkin maxim-belkin requested a review from wrightaprilm May 17, 2019 19:56
@wrightaprilm
Copy link
Copy Markdown
Contributor

Oooh boy, how annoying. I'm not sure what to do here. If they follow our install instructions, they will download python 3.7, in which dicts are ordered. So, I guess my feeling is that we should just remove this, since this won't be the behavior going forward. I'm not sure if I think we should replace it with anything. Maybe something like:

"Like lists, dictionaries are ordered. However, ordered dictionaries are a recent innovation in python, and when you look for help on the internet or look at someone else's code from a published paper, you may find references to dictionaries being unordered."

@maxim-belkin
Copy link
Copy Markdown
Contributor Author

Like lists, dictionaries are ordered

Yeah.... about that.... They preserve the insertion order but they aren't ordered. Let's, perhaps, just delete the paragraph.

@wrightaprilm wrightaprilm merged commit 5beb15c into datacarpentry:gh-pages May 27, 2019
@maxim-belkin maxim-belkin deleted the python-dict-fix1 branch January 28, 2020 19:07
zkamvar pushed a commit that referenced this pull request May 8, 2023
01-short-introduction-to-Python.md: remove statement about order in Python dicts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants