python destructuring-bind dictionary contents
Posted
by Stephen
on Stack Overflow
See other posts from Stack Overflow
or by Stephen
Published on 2010-06-02T06:17:28Z
Indexed on
2010/06/02
6:33 UTC
Read the original article
Hit count: 226
python
Hi,
I am trying to 'destructure' a dictionary and associate values with variables names after its keys. Something like
params = {'a':1,'b':2}
a,b = params.values()
but since dictionaries are not ordered, there is no guarantee that params.values() will return values in the order of (a,b). Is there a nice way to do this?
Thanks
© Stack Overflow or respective owner