Pydantic AI: Build Type-Safe LLM Agents in Python Quiz - Real Python
An interactive quiz assesses knowledge of Pydantic AI, covering type-safe LLM agents, model providers, structured outputs, tool registration, dependency injection, and production trade-offs.
Duck Typing in Python: Writing Flexible and Decoupled Code Quiz - Real Python
An interactive quiz assesses understanding of duck typing in Python, covering its definition, advantages, disadvantages, behavior-based interfaces, protocols, special methods, and alternative approaches.
All Python iteration forms use the same iterator protocol; iterating over an object yields its defined iteration items (e.g., dictionary yields keys, string yields characters).
CPython vs. PyPy: Which Python runtime has the better JIT?
PyPy remains far faster for raw numerical workloads, but CPython's new native JIT and no-GIL builds close the gap in other workloads and enable threading.
Planning Meals, Weekly Shop, Alternative Constructors Using Class Methods
Use alternative constructors via class methods to build Meal and WeeklyMealPlanner objects and protect internal state with read-only properties and shallow copies.