[Python-ideas] A sorted version of **kwargs

Imri Goldberg lorgandon at gmail.com
Thu Jan 20 17:53:54 CET 2011

On Thu, Jan 20, 2011 at 6:42 PM, Guido van Rossum <guido at python.org> wrote:
> > -1.
> >
> > How often do you really need this ?
> >
> > In which of those cases wouldn't a static code analysis give you
> > the call order of the parameters already  ?
> >
> > "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...

What if the default behavior stays as it is today, but a magic decorator is
added, (maybe @ordered_kwargs or some such),
and only for these kind of functions the new behavior applies.
Also, given such a decorator, when given **d where d is a regular dict, the
implementation could possibly throw an error. (Or maybe it is up to the
implementor of the specific function).


Imri Goldberg
http://plnnr.com/ - automatic trip planning
-- insert signature here ----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110120/0bf7be8a/attachment.html>

More information about the Python-ideas mailing list