(original) (raw)

On 10 September 2016 at 03:17, Guido van Rossum <guido@python.org> wrote:
I've been asked about this. Here's my opinion on the letter of the law in 3.6:

\- keyword args are ordered
\- the namespace passed to a metaclass is ordered by definition order
\- ditto for the class \_\_dict\_\_

A compliant implementation may ensure the above three requirements
either by making all dicts ordered, or by providing a custom dict
subclass (e.g. OrderedDict) in those three cases.

I'd like to add one more documented constraint - that dict literals maintain definition order (so long as the dict is not further modified). This allows defining a dict literal and then passing it as \*\*kwargs.

Hmm - again, there's no mention of dict literals in the PEPs. I'm assuming that dict literals will preserve their definition order with the new implementation, but is that a valid assumption? Guess I can test it now 3.6.0b1 is out.

Tim Delaney