First list are mutable while tuples are not, and second tuples can be hashed
e.g. to be used as keys for dictionaries.
As an example of their usage, tuples are used when the order of the elements in the sequence matters e.g. a geographic coordinates, "list" of points in a path or route, or set of actions that should be
executed in specific order.
Don't forget that you can use them a dictionary keys. For everything else use lists.
No comments:
Post a Comment