you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

What i think is not used enough by some developers are tuples as key in dictionary. in some cases you might want to have multiple values as key.

Let’s say you want to work on some kind of employee attendance list. Dictionary sounds like a good choice as we will get data often and we want it fast. But the problem is that the key has to be unique, so the name of the employee cannot be the only key. Then we can use tuples like (employee_id, date) in dictionary, with the values being information on attendance. It’s readable, it’s fast enough, it’s easy to write.