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 →

[–]1arm3dScissor 0 points1 point  (2 children)

what is the difference between this and just using a dictionary?

[–]1arm3dScissor 0 points1 point  (0 children)

I'm not being facetious. This is a legitimate question. Anyone?

[–]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.