21. Short Q&A Prompts
Rapid prompts to demonstrate depth and judgment on the spot.
- Contrast
__getattr__
vs__getattribute__
; show a safe pattern to avoid recursion. - Explain the descriptor protocol and implement a validated field.
- Metaclass practical use: registration or auto-validation.
- Backpressure in
asyncio
: semaphores vs bounded queues; when to use each? - Prevent cache stampede: locks, TTL jitter, refresh-ahead, single-flight.
- Exactly-once vs effectively-once; design idempotent consumers.
- Transaction isolation levels: choose one for a given scenario and justify.
- Transactional Outbox: why it solves dual-write problems.
- Observability: when to add tracing spans vs structured logs.
- JWT pitfalls and key rotation strategy.