[Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Tue Sep 13 06:23:56 EDT 2016
- Previous message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Next message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 13 September 2016 at 12:37, Tim Delaney <timothy.c.delaney at gmail.com> wrote:
Personally I expect all Python 3.6 implementations will have order-preserving dict as that's the easiest way to achieve the existing guarantees.
Not all Python 3 implementation will be able to afford the memory hit that comes from doing that relative to their current approaches (e.g. MicroPython), and others may be relying on a 3rd party VM for their core data structures which may not offer a hash map with these characteristics (VOC and the JVM, Batavia and JavaScript runtimes)
Using collections.OrderedDict selectively may not impose too large a memory or performance hit, but using it pervasively likely would.
And that enough code will come to depend on an order-preserving dict that eventually the decision will be made to retrospectively guarantee the semantics.
We explicitly want to discourage that though, as one of the "alternate deployment targets" we'd like folks to retain compatibility with at the library and framework level is single-source 2/3 deployments. Most incompatibilities are splashy ones that can be detected easily just by testing on older versions, but this one can be a bit hard to pick up if you don't already know to check for it.
The benefit of making the official stance be that dict-ordering-as-the-default-behaviour is an implementation detail, is that it puts the burden of maintaining compatibility on library and framework developers, and application developers that support "bring your own Python runtime" deployments, not on interpreter implementers.
Cheers, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Next message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]