Wrapping is a way to understand a collection. It can be a class that is an aggregate of independent objects. It's also a composition that wraps an existing list, meaning that the underlying Card objects will be shared by a list collection and a Deck collection.
- Define the independent collection. It might be a built-in collection, for example, a set, list, or dict. For this example, it will be a list that contains the cards:
domain = [Card(r+1,s) for r in range(13) for s in SUITS]
- Define the aggregate class. For this example, the name has a _W suffix. This is not a recommended practice; it's only used here to make the distinctions between class definitions more clear. Later, we'll see a slightly ...