[Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered (original) (raw)

Tim Delaney timothy.c.delaney at gmail.com
Mon Sep 12 19:50:58 EDT 2016


On 10 September 2016 at 03:17, Guido van Rossum <guido at 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160913/78daba08/attachment.html>



More information about the Python-Dev mailing list