[Python-Dev] Guarantee ordered dict literals in v3.7? (original) (raw)
Stefan Krah stefan at bytereef.org
Sun Nov 5 13:39:31 EST 2017
- Previous message (by thread): [Python-Dev] Guarantee ordered dict literals in v3.7?
- Next message (by thread): [Python-Dev] Guarantee ordered dict literals in v3.7?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Nov 05, 2017 at 01:14:54PM -0500, Paul G wrote:
I'm not entirely sure I understand the full set of reasoning for this - I couldn't really tell what the problem with OrderedDict is from the link Stefan provided. It seems to me like a kind of huge change for the language to move from arbitrary-ordered to guaranteed-ordered dict. The problem I see is that this introduces a huge backwards compatibility burden on all implementations of Python.
Scientific applications want something like
{'a': 10, 'b': "foo", 'c': {'this': b'123'}}
as an ordered initializer for unboxed or typed (or both) data. In general, if dicts are ordered, they can be used for example as initializers for (nested) C structs.
2. Someone invents a new arbitrary-ordered container that would improve on the memory and/or CPU performance of the current dict implementation
I would think this is very unlikely, given that the previous dict implementation has always been very fast. The new one is very fast, too.
Stefan Krah
- Previous message (by thread): [Python-Dev] Guarantee ordered dict literals in v3.7?
- Next message (by thread): [Python-Dev] Guarantee ordered dict literals in v3.7?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]