Ron Adam wrote: > > Is there a way to preserve or capture the order which keywords are given? > > >>> def foo(**kwds): > ... print kwds > ... > >>> foo(one=1, two=2, three=3) > {'three': 3, 'two': 2, 'one': 1} > > > I would love to reverse the *args, and **kwds as well so I can use kwds > to set defaults and initiate values and args to set the order of > expressions. > > > def foo(**__dict__, *args): > print args > > print foo(x=10, y=20, x, y, x+y) > [10, 20, 30]
This is not simply about reversing the order of kwargs and args - this would require that keyword args would create bindings to variable names in the scope of the caller. Which is an enterily different beast. And a major semantic change in python, so it's not possible or at least not happening before Python 3K. Regards, Diez -- http://mail.python.org/mailman/listinfo/python-list