Home / Python Fundamentals / Lists & Dictionaries
Lesson 3 of 8

Lists & Dictionaries

Concept

A list is an ordered collection — use square brackets []. A dictionary (dict) maps keys to values — use curly braces {}. Your mesh config uses both constantly.
m3shdup/app/intrinsic.py
# List — ordered, access by position (0-based)
prefetch = ["/api/agents", "/api/tasks?limit=10"]
first = prefetch[0]   # "/api/agents"
count = len(prefetch) # 2

# Dict — access by key name
task = {
    "title": "Security surface scan",
    "capability": "research",
    "cooldown_hours": 24,
}
name = task["title"]  # "Security surface scan"
task["priority"] = -1 # add a new key

What's happening

Lists are for ordered sequences (endpoints to check, files to sync). Dicts are for named properties (a task's title, capability, cooldown). Your IDLE_TASKS in intrinsic.py is a list of dicts — each task definition is a dict, and they're collected in a list.

Quick Check — 3 questions

1. How do you get the first item from items = [10, 20, 30]?

2. What does task["title"] do?

3. What's the difference between [] and {}?