Every program built so far has been organised around functions operating on Python's built-in types — numbers, strings, lists, dictionaries. This topic introduces a second organisational tool: bundling data and the operations on that data together into a single unit, a class.
docs/programme-profiles/library/introduction-to-python.md names this Stage 6, "when data and behaviour belong together" — the natural next step once a program's data grows structured and specific enough (a student's name and grades, a mortgage's balance and payment schedule) that treating it as a loose collection of related variables becomes error-prone. This topic builds a small class from scratch, extends it into a family of related classes through inheritance, and closes with a worked mortgage-comparison example that shows why library code throughout the scientific Python ecosystem — and this vault's own quant-finance notes on instruments and portfolios — is organised exactly this way.In this lesson
- Learning objectives
- Contents
- The big picture
The full lesson is for members.
Read the full lessonNew to SelfMadeQuant.com? See membership options or browse the Python for Quantitative Finance syllabus.