Classes and objects
A class bundles state (attributes) and behaviour (methods); each instance gets its own state via init. In LLD rounds this is the building block for every entity: ParkingLot, Vehicle, Account, Order.
Inheritance
A subclass reuses and specialises a base class; call super().init to initialise the parent's state and override methods to change behaviour. In LLD use it for true "is-a" hierarchies (Car is a Vehicle) and prefer composition for "has-a".
Abstract base classes
An ABC defines an interface: subclasses must implement every @abstractmethod or they can't be instantiated. In LLD use it to declare contracts like PaymentMethod, ParkingStrategy or Notifier that concrete classes implement.
Protocols
typing.Protocol defines an interface by shape (structural typing): any class with the right methods matches, no inheritance needed. Use it in LLD answers when you want duck-typed interfaces (Notifier, Comparable) that third-party or unrelated classes can satisfy.
Properties
@property lets you expose an attribute while running code on get/set/delete, so callers keep writing obj.x. Use it in LLD answers for validation (non-negative balance), read-only fields, and computed attributes.
classmethod and staticmethod
@classmethod receives the class (cls) and is the idiomatic way to write alternate constructors; @staticmethod receives nothing and is just a helper namespaced in the class. In LLD rounds use classmethods for fromdict/fromstring factories and staticmethods for pure validation/utility logic.
Dunder methods
Dunder ("double underscore") methods hook your class into Python syntax: printing, ==, hashing, sorting, len, in, iteration, indexing, truthiness and calling. You'll mostly need repr, eq/hash (dict/set keys) and lt (sorting and heapq).
Dataclasses
@dataclass generates init, repr and eq from annotated fields, cutting LLD boilerplate for entities and value objects. Know field(defaultfactory=...), frozen=True (immutable and hashable), order=True (sortable) and postinit for validation.
Enums
Enum gives a fixed set of named constants, which is ideal for LLD states and categories (OrderStatus, VehicleType, SpotSize). Members are singletons compared with is/==, iterable, and can be looked up by value or by name.
Type hints
Annotations document intent and let type checkers catch bugs; Python itself doesn't enforce them at runtime. In LLD, typed signatures make your class design readable at a glance. Use built-in generics (list[int]), X | None, and the 3.12+ generic syntax.
__slots__ and naming conventions
slots replaces the per-instance dict with fixed storage x is "internal by convention", _x triggers name mangling to avoid clashes in subclasses.
Custom exceptions
Define a small exception hierarchy rooted at one app-level base so callers can catch broadly (AppError) or precisely (InsufficientFunds). In LLD answers, domain exceptions with extra fields make error handling explicit and testable.
Unit testing
unittest is the stdlib test framework dependencies (repos, clocks, payment gateways) are injected so tests can swap in fakes or mocks. Tests should be fast, isolated and deterministic.