We have a syntax to create strings with variables automatically inferred
from its context:
>>> name = "Guido"
>>> print(f'Hello {name}')
Hello Guido
Similarly, I'd like to suggest a similar feature for building dictionaries:
>>> foo = 1
>>> bar = 2
>>> {:bar, :foo}
{'bar': 1, 'foo', 2}
And a similar way to get the content from the dictionary into variables:
>>> values = {'bar': 1, 'foo', 2}
>>> {:bar, :foo} = values
>>> bar
1
>>> foo
2
The syntaxes used here are of course just to illustrate the concept and
I'm suggesting we must use those.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/