On Thu, Jan 20, 2011 at 8:42 AM, Guido van Rossum <guido@python.org> wrote:
On Thu, Jan 20, 2011 at 6:05 AM, M.-A. Lemburg <mal@egenix.com> wrote:

> "Nice to have" is not good enough to warrant a slow down of
> all function calls involving keyword arguments, adding overhead
> for other Python implementations and possibly causing problems
> with 3rd party extensions relying on getting a PyDict for the
> keyword arguments object.

What he says.

In addition, I wonder what the semantics would be if the caller passed
**d where d was an *unordered* dict...

--
--Guido van Rossum (python.org/~guido)


Agree with both. And if we were to make this change, my next thought is that what I really want is an ordered multi-set, since in some scenarios where I want ordered parameters I also want repeated parameters. I don't think we should go there.

Back to the original problem though: if the issue is that creating an ordered dict is clumsy and perhaps interfering with adoption and usage then perhaps the notation for ordered dict could be improved. Just as we can now use {...} for both dicts and sets, perhaps we could add

[ 'b' : 1, 'a' : 2 ]
as a more convenient way of writing
OrderedDict([('b', 1), ('a', 2)])

This is parallel to the way that [1,2] is an ordered container while {1,2} is unordered.

--- Bruce
Latest blog post: http://www.vroospeak.com/2010/12/fix-filibuster.html
Learn about security: http://j.mp/gruyere-security