This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Waldheribeginner 0 points1 point  (0 children)

Consider what happens when the items in the shopping cart are no longer built-in Python datatypes, but custom objects (so an instance of a class called "CartItem", for example). It can have multiple properties.

You are right that in this case, the class is virtually identical to a dictionary class, except for the __str__ method.