On Wed, May 15, 2013 at 10:20 AM, <random832@fastmail.us> wrote:
On Tue, May 14, 2013, at 21:57, Don Spaulding wrote:
> I don't understand the dismissal of OrderedDict.__init__ as an invalid
> use
> case.  It would be a substantial usability improvement to special-case
> OrderedDict at compile-time purely to get the ability to instantiate
> odict
> literals (not that I'm suggesting that).

Maybe we should be talking about literals. OrderedDict(a=3, b=3, c=7) is
not and never will be a literal.

Forgive my misuse of the term 'literal' here.  I meant only to say that anywhere you currently use a plain-old-dictionary literal, there's no way to easily switch it to a value which preserves its order.  For example:

foo = {
    'b': 1,
    'a': 2

Has to turn into something far less appealing:

foo = OrderedDict()
foo['b'] = 1
foo['a'] = 2

# or...

foo = OrderedDict([
    ('b', 1),
    ('a', 2)

Even if the only ordering change that was made was to magically give OrderedDict.__init__ its **kwargs in order, it would clean up these instances, which I initially referred to as literals.

foo = OrderedDict(

I was explicitly not advocating that change, just noting that the OrderedDict.__init__ use case is a perfect example of how this would be used to enable something that currently isn't possible without, IMO, extra noise in the definition of dicts of this nature.