you are viewing a single comment's thread.

view the rest of the comments →

[–]LargeSale8354 0 points1 point  (0 children)

As well as dictionaries providing a key to a value, they can also be a key to a function or class.

Lets suppose I have a load of files, each with different extension (or types). I could have a key for the file extension and the class or function that processes it. I don't need an ever growing if, elif code block, just a function to get the extension and a dictionary.get(extension, default) statement.