All jobs / Automation developer

Automation developer interview question · 1–3 years

Can you rely on a dict keeping insertion order?

The strongest answer

Yes since Python 3.7 it is part of the language spec — but if the order is meaningful to the reader, say so, and use OrderedDict when you need order-sensitive equality or move_to_end

Why it works

Right, and the caveat about equality is the part that still matters.

What a good answer covers

Answers that fall short

Who gets asked this

More Automation developer questions