datacarpentry / python-ecology-lesson

Data Analysis and Visualization in Python for Ecologists
https://datacarpentry.org/python-ecology-lesson
Other
160 stars 310 forks source link

Update 01-short-introduction-to-Python.md #432

Closed yrad closed 4 years ago

yrad commented 4 years ago

Short elaboration on what "hashable" means. If "hashable" is used to explain a concept it needs to be better communicated. Without elaboration it is an example of minimal guidance and could better be removed. A short elaboration makes it possible to pose the question "Why not lists".

maxim-belkin commented 4 years ago

Thank you, Duncan. I agree with you in that we should either explain what "hashable" is or not mention it at all. Provided that this is a short intro to Python, I suggest we do the latter. Are you up for that? Alternatively, we could rewrite the whole paragraph/section, because it is best not to use integers/floating-point numbers as keys...

yrad commented 4 years ago

For sure. The gist of the lesson about dictionaries is that a dictionary is unordered, judging by the 'key points' summary and instructor notes. Happy to have the hashable bit removed. That said, it does reappear in the traceback error. Is the dictionary introduced as a vehicle for the traceback error?

maxim-belkin commented 4 years ago

For sure. The gist of the lesson about dictionaries is that a dictionary is unordered, judging by the 'key points' summary and instructor notes.

Let's update the lesson and instructor notes to remove the "unordered" piece. While dictionaries are unordered (that is, if a is a dict with keys "one" and "two" and b is a list with two elements, a["one"] is not connected to a["two"] as b[0] is to b[1]), insertion order in dictionaries is preserved (recent change) and us saying that dictionaries are unordered has already confused quite a few people.

That said, it does reappear in the traceback error. Is the dictionary introduced as a vehicle for the traceback error?

No. We can and, perhaps, should remove the traceback error itself. What do you think?

yrad commented 4 years ago

Let's update the lesson and instructor notes to remove the "unordered" piece.

Will do.

insertion order in dictionaries is preserved (recent change)

I've learned something :)

remove the traceback error

Sure, the Tuples vs. Lists exercise generates a traceback error so removing the dictonary traceback would not erase errors entirely. I'll modify the pull request.

maxim-belkin commented 4 years ago

Sure, the Tuples vs. Lists exercise generates a traceback error so removing the dictonary traceback would not erase errors entirely. I'll modify the pull request.

Thank you. Let's update the episode incrementally. It is always better to have several small PRs than a few big ones.