inheritance

Class inheritance and method overriding, letting classes reuse and extend behavior from parents.

Python OOP Project: Build a Bank Account Manager (Capstone)

This Python OOP project answers the question every beginner quietly asks after learning classes: when would I actually create one? We will build a small bank account manager that uses inheritance, magic methods, properties, custom exceptions, and JSON persistence, the exact tools you met one at a time across the OOP chapter, snapped together into a program you can run and keep. “An expert is a person who has made all the mistakes that can be made in a very ... Read More

Python: Dataclasses, Modern Data Containers

A Python dataclass writes the boring parts of a class for you: the __init__, the __repr__, and the __eq__. You declare the fields once with type annotations, add @dataclass on top, and Python fills in the rest. This post is a recipe book of dataclass patterns: simple defaults, mutable default factories, frozen immutability, computed fields with __post_init__, and the memory savings from slots. “The best code is the code you never had to write.” Jeff Atwood, Coding Horror Last Updated: ... Read More

Python: Property Decorators, @property, getter, setter

Java developers write getters and setters for every field, just in case one ever needs validation. Python skips that ceremony entirely. A Python property lets you ship a plain attribute today and slip validation or a computed value behind it tomorrow, without touching a single caller. This post covers @property getters, setters, and deleters, plus the patterns you will actually reuse. “A good API is not just easy to use but also hard to misuse.” Joshua Bloch, Effective Java Last ... Read More