On Fri, May 18, 2018 at 12:30 AM, bartc <b...@freeuk.com> wrote: > Anyway, try this: > > def showarg(x): print(x) > > def dummy(*args,**kwargs): pass > > dummy(a=showarg(1),*[showarg(2),showarg(3)]) > > This displays 2,3,1 showing that evaluation is not left to right. >
Keyword args are evaluated after positional args. It's a bad idea to put positional after keyword; you risk mis-identifying your args: >>> def dummy(a, b, c): pass ... >>> dummy(a=showarg(1),*[showarg(2),showarg(3)]) 2 3 1 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: dummy() got multiple values for argument 'a' Evaluation is not always left to right, but it is always well-defined. ChrisA -- https://mail.python.org/mailman/listinfo/python-list