At some point, we're really better off just using a lambda.
Maybe I'm slow today, but I'm having trouble seeing how to write this as
a lambda.
>>> values = {'x': 43, 'y': 55}
>>> x, y, z = (lambda *args : tuple(values.get(arg,0) for arg in args))('x','y','z')
>>> print(x, y, z)
(43, 55, 0)
>>>

Rob Cliffe
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to