Code24Lab

Dunder Methods II: Make a Cart Behave Like a List

Lesson 7 of 21 Lab ๐Ÿ”’ Locked

Lessons in this course

  1. Classes & Objects: Model Products with __init__ and MethodsLabFree
  2. Class vs Instance Attributes: Shared Defaults and ShadowingLab Locked
  3. Properties: Validated Attributes with @property and SettersLab Locked
  4. Inheritance & super(): Extend Products without Copying CodeLab Locked
  5. Polymorphism & MRO: One Call, Many Shipping ClassesLab Locked
  6. Dunder Methods I: __repr__, __eq__, __lt__ and Sorting ObjectsLab Locked
  7. Dunder Methods II: Make a Cart Behave Like a ListLab Locked
  8. Operator Overloading: A Money Class with +, * and Exact CentsLab Locked
  9. Dataclasses: Less Boilerplate, Ordering and __post_init__Lab Locked
  10. Modules: Import Once, Names, Bindings and reload()Lab Locked
  11. Packages: __init__.py, Relative Imports and Import CostLab Locked
  12. List Comprehensions: Map, Filter and Conditional ExpressionsLab Locked
  13. Dict & Set Comprehensions: Group, Deduplicate, Last-WinsLab Locked
  14. Built-ins with key=, Generators and next(): Idiomatic SearchingLab Locked
  15. Exceptions: try, except, else, finally and Control FlowLab Locked
  16. Custom Exceptions: Hierarchies, raise and Handler OrderLab Locked
  17. Regular Expressions I: Anchors, Classes and QuantifiersLab Locked
  18. Regular Expressions II: Groups, findall and TuplesLab Locked
  19. Testing with pytest: assert, parametrize and Boundary CasesLab Locked
  20. pytest Fixtures, Scopes and CoverageLab Locked
  21. Capstone: A Tested Checkout with Classes, Exceptions and Exact CentsLab Locked