Comment on Ask HN: What's your favorite Python quirk?Comments−wamplerOP10yAbusing locals() - learnt it from @jrollerdef foo(): """ >>> foo() {'a': 1, 'c': 3, 'b': 2} """ a = 1 b = 2 c = 3 return locals()
Comments
Abusing locals() - learnt it from @jroller
def foo(): """ >>> foo() {'a': 1, 'c': 3, 'b': 2} """ a = 1 b = 2 c = 3 return locals()