On 1/30/2019 2:32 PM, Raymond Hettinger wrote:
Now that regular dicts are ordered and compact, it makes more sense for the 
_asdict() method to create a regular dict (as it did in its early days) rather 
than an OrderedDict.
...
Option 4) Just make the change directly in 3.8,  s/OrderedDict/dict/, and be 
done will it.  This gives users the benefits right away and doesn't annoy them 
with warnings that they likely don't care about.   There is some precedent for 
this.  To make namedtuple class creation faster, the *verbose* option was 
dropped without any deprecation period.  It looks like no one missed that 
feature at all, but they did get the immediate benefit of faster import times.  
In the case of using regular dicts in named tuples, people will get immediate 
and significant space savings as well as a speed benefit.

My recommendation is Option 4 as being less disruptive and more beneficial than 
the other options.  In the unlikely event that anyone is currently depending on 
the reordering methods for the output of _asdict(), the remediation is trivially 
simple:   nt._asdict() -> OrderedDict(nt.as_dict()).

What do you all think?
Option 4 sounds good to me.

Would it be practical to add deprecated methods to regular dict for the OrderedDict reordering methods that raise with an error suggesting "To use this method, convert dict to OrderedDict." (or some better wording).
_______________________________________________
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