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 the engineer's understanding of Python's bytecode compilation and optimization mechanisms, specifically their ability to use the dis module to analyze constant folding and bytecode transformations.",
"type": "weighted_checklist",
"checklist": [
{
"name": "dis.dis() usage",
"description": "Uses dis.dis() or dis.Bytecode() to disassemble code snippets and extract bytecode instructions",
"max_score": 20
},
{
"name": "compile() function",
"description": "Uses compile() with appropriate mode ('eval' or 'exec') to convert code strings into code objects for bytecode analysis",
"max_score": 15
},
{
"name": "LOAD_CONST detection",
"description": "Correctly identifies LOAD_CONST instructions in bytecode to detect when constant folding has occurred",
"max_score": 20
},
{
"name": "co_consts access",
"description": "Accesses the co_consts attribute of code objects to extract optimized constant values after folding",
"max_score": 15
},
{
"name": "Instruction parsing",
"description": "Properly parses bytecode instructions to extract opnames and arguments from dis.Bytecode or similar objects",
"max_score": 15
},
{
"name": "Folding detection logic",
"description": "Implements correct logic to distinguish between folded constants (single LOAD_CONST) and non-folded operations (multiple instructions)",
"max_score": 10
},
{
"name": "Instruction counting",
"description": "Accurately counts bytecode instructions to compare optimization levels across code variants",
"max_score": 5
}
]
}