csev/py4e

Chapter 9, dictionary order as of Python 3.7 no longer unpredictable

tom-price opened this issue · 3 comments

I noticed an inaccuracy due to a change in python 3.7 that, to my understanding, made it a language feature that dictionaries are ordered by insertion order.

The order of the key-value pairs is not the same. In fact, if you type the same example on your computer, you might get a different result. In general, the order of items in a dictionary is unpredictable.

This means one of the questions in the chapter 9 quiz on Coursera is now ambiguous and based on which version of Python 3 you're using.

csev commented

Thanks - I will keep this open. Someday we will redo everything (book, slides, videos) for use with a later version of Python and catch this. I will just hold the issue open as a reminder.