27 Jun
2018
27 Jun
'18
9:19 a.m.
On Wed, Jun 27, 2018 at 05:52:16PM +1000, Chris Angelico wrote:
def test(): a = 1 b = 2 vars = {key: locals()[key] for key in locals()} return vars
What would your intuition say? Should this be equivalent to dict(locals()) ?
That example is so elegant it makes me want to cry. And not just because you shadowed the vars() builtin *wink* -- Steve