+ 1

What would be a good example of a problem where using a tuple as a dictionary key is an effective solution?

8th Aug 2016, 8:44 PM
Aaron Vann
Aaron Vann - avatar
2 ответов
0
possibly if you wanted to "flatten" a multi dimensional array. for example, if you had valued at x,y co-ordinates, you could use a list of lists: res=val[x][y] or a dictionary with a tupple key: res=val[(x,y)] The second option would be better if you did not have values at all x and y combinations.
20th Aug 2016, 11:08 PM
Ryan
- 1
i imagine that they could be used as a sort of a schema or strict glossary ("a"==="a1")
10th Aug 2016, 12:19 AM
Albert Rosenfield
Albert Rosenfield - avatar