Classes & OOP
Classes & OOP (Python, university-level)
Notebook (download/open locally): /kicsigeze/notebooks/01_classes_oop.ipynb
What you should get out of this
- Design classes with invariants and clean APIs
- Understand attribute lookup,
__getattribute__, and the descriptor mechanism at a practical level - Use dataclasses and typing to make code more correct and readable
- Implement iteration, context managers, and rich comparisons the Pythonic way
Suggested workflow
- Open the notebook in JupyterLab/VS Code.
- Run the “warm-up” cells quickly.
- Spend most of your time on the Exercises.
Exercises (quick list)
- Implement a
Vectortype with normalization + rich comparisons - Implement a small
LRUCacheusing__getitem__/__setitem__ - Write a context manager that measures elapsed time and logs it
Readings/videos: Reading / Videos