[Python-ideas] A sorted version of **kwargs
alexander.belopolsky at gmail.com
Thu Jan 20 19:57:50 CET 2011
On Thu, Jan 20, 2011 at 11:42 AM, Guido van Rossum <guido at python.org> wrote:
> In addition, I wonder what the semantics would be if the caller passed
> **d where d was an *unordered* dict...
Presumably, the caller would know whether the called function is
sensitive to the order of keyword arguments and will use odict when it
matters. The function called as say f(x=1, y=2, **d) will initialize
its internal keyword odict with an equivalent of kwds = odict([('x',
1), ('y', 2)]); kwd.update(d.items()) and exhibit undefined behavior
if d is unordered and f depends on the order of keywords.
More information about the Python-ideas