I have a dictionary as such:
test = {'tuple':(1, 2, 3, 4), 'string':'foo', 'integer':5}
In order to keep down wasted space, I'd like to unpack these values into individual variables. I know that it is possible to unpack the keys of a dictionary:
>>> a, b, c = test
>>> print(a, b, c)
tuple string integer
But what I'd like to do is unpack the dictionary values. Somehthing like this:
>>> tuple, string, integer = test
>>> print(tuple, string, integer)
(1, 2, 3, 4) string 5
Is this possible? If not, I think if the variables you unpack to correspond to values inside the dictionary, it should unpack the values into the appropriate variable (like is shown above).
Or is my only way to do this is like this?:
>>> tuple, string, integer = test['tuple'], test['string'], test['integer']