concept
Python Data Shapes
Python Data Shapes
Python Data Shapes is a practical way to think about the structure of data at runtime: string, list, dict, or object. In Brevvie Python + AI — Section 2: Control Flow & The Treasure Hunt, this idea is central to the treasure-hunt activity.
Shapes used in the source
- strings containing rune text
- lists of room descriptions
- dict-based spellbooks
- dataclass-based adventurer objects
Why it matters
The capstone Hunter function works by inspecting shape at runtime and choosing a matching strategy. This is a common real-world parsing pattern when data is heterogeneous or nested.