Hacking The Fender "Dictionary" question

Hi! i have question - is “Ordered dictionary” the same to “Dictionary”? in the video i see a regular dictionary instead of what i have, check out screenshot please.

1 Like

Not quite, no.

OrderedDict is a unique object of its own. It’s not as useful nowadays, because since Python 3.7 the regular dict object exhibits some of the behaviour that the OrderedDict was created to address - like remembering the order in which items are added to the dictionary.

You can see the differences between OrderedDict and dict in the Python docs, here.

I suspect that the reason you’re seeing something different to the video, is because the behaviour of csv.DictReader() changed in Python 3.6.

In versions of Python prior to v3.6, csv.DictReader() returned a regular dict object. From Python 3.6 onwards, it returns the OrderedDict object which you’re seeing. If the video recording was using an older version, say Python 3.5, they’d be getting a dict type back because that was the functionality at the time.

Hope that helps. :slight_smile: