> 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.

I can understand why you'd want an ordered container, I just don't see why it 
must be a dict. Why can't it be:

    OrderedDict(a=10, b='foo', c=OrderedDict(this=b'123'))

Is it just that you don't want to type OrderedDict that many times? If it's so 
important to provide ordered dictionary literals, I would think it's a 
no-brainer to give them their own literal syntax (rather than re-defining dicts 
to have guaranteed order). e.g.:

    o{'a': 10, 'b': 'foo', 'c': o{'this': b'123'}

Then there is no backwards incompatibility problem and users can express 
whether order does or does not matter to them when initializing a container.

On 11/05/2017 01:39 PM, Stefan Krah wrote:
> 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.
> 

> 
> 
> 
>> 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
> 
> 
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> https://mail.python.org/mailman/options/python-dev/paul%40ganssle.io
> 

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to