tessl install tessl/pypi-wtfpython@3.0.0Educational collection of surprising Python code snippets that demonstrate counter-intuitive behaviors and language internals
Agent Success
Agent success rate when using this tile
93%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.06x
Baseline
Agent success rate without this tile
88%
{
"context": "This evaluation assesses how well the engineer handles Python's mutable default argument pitfall and object reference semantics. The key challenge is avoiding shared mutable state across function calls by properly initializing default arguments within the function body rather than in the function signature.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Mutable default avoidance",
"description": "The register() method must NOT use mutable default arguments directly (e.g., tags=[], config={}). Instead, it should use None as default and create new instances inside the function body (e.g., tags = tags if tags is not None else [] or tags = tags or []).",
"max_score": 40
},
{
"name": "Independent storage",
"description": "When storing tags and config, the implementation must store copies or new instances to prevent external modifications from affecting the registry. This can be done using list() constructor, [:] slicing for lists, dict() constructor, or .copy() for dicts.",
"max_score": 30
},
{
"name": "Defensive copying",
"description": "The get_metadata() method must return new instances or copies of the stored tags list and config dict to prevent callers from mutating the internal state. Should use list(), [:], dict(), or .copy() when returning metadata.",
"max_score": 20
},
{
"name": "Correct execution",
"description": "The execute() method correctly calls the registered function with provided arguments and returns the result without modifying metadata.",
"max_score": 10
}
]
}