On Jul 28, 2014, at 15:15, Alexander Heger <python@2sn.net> wrote:
In all honesty, I'd suggest that code which looks bad enough to warrant even considering this feature is probably badly in need of refactoring, at which point the problem will likely go away.
I often want to call functions with added (or removed, replaced) keywords from the call.
args0 = dict(...) args1 = dict(...)
def f(**kwargs): g(**(arg0 | kwargs | args1))
currently I have to write
args = dict(...) def f(**kwargs): temp_args = dict(dic0) temp_args.update(kwargs) temp_args.update(dic1) g(**temp_args)
No, you just have to write a one-liner with ChainMap, except in the (very rare) case where you're expecting g to hold onto and later modify its kwargs.
It would also make the proposed feature to allow multiple kw args expansions in Python 3.5 easy to write by having
f(**a, **b, **c) be equivalent to f(**(a | b | c))
-Alexander _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/