Practice mode Python

From which Python version is preservation of dictionary insertion order a guaranteed language feature?

Correct answer C. Python 3.7

Explanation

Dictionaries are documented as preserving insertion order from Python 3.7 onwards. CPython 3.6 already behaved this way, but only as an implementation detail that other interpreters need not follow. Before that, collections.OrderedDict was needed when order mattered, and it still offers extra methods such as move_to_end().

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.