On 7/4/19 3:53 PM, Alan Gauld via Tutor wrote:

>> Does this means that the Dict is ordered? or it is implementation dependent?
> 
> Neither, it means the items in a list always have indexes
> starting at zero.
> 
> By pure coincidence dictionaries in recent Python versions (since 3.6
> or 3.7???) retain their insertion order. But that was not always the
> case, but the result would have been the same so far as the 0,1,2 bit goes.
> 

To be a little more precise, in 3.6 CPython insertion order was
preserved as an artefact of the new implementation of dicts, but not
promised to be that way. Since 3.7 it is guaranteed (it is actually in
the language specification, so other Pythons have to do this too now).

It's still not the same as a collections.OrderedDict, which has some
useful additional features in case you care a lot about ordering.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to