We'll look at some extensions we might make to Python's built-in container classes. We won't show an example of extending each container.
We'll pick an example of extending a specific container and see how the process works:
- Define the requirements. This may include research on Wikipedia, generally starting here: http://en.wikipedia.org/wiki/Data_structure. Designs of data structures often involve complex edge cases around missing items and duplicate items.
- If necessary, look at the collections.abc module to see what methods must be implemented to create the new functionality.
- Create some test cases. This also requires careful study of the algorithms to ensure that the edge cases are properly covered.
- Write code based on the previous research steps.
We need to emphasize the importance of researching the fundamentals before...