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 criteria evaluates how well the engineer demonstrates understanding of Python's exception handling internals, specifically the automatic deletion of exception variables after except blocks and the finally block's ability to override return statements in try/except blocks.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Exception variable capture",
"description": "Uses 'except ExceptionType as var:' syntax to capture an exception into a variable within an except block",
"max_score": 15
},
{
"name": "Variable deletion detection",
"description": "Attempts to access the exception variable outside the except block (after the except block ends) and properly handles the error that results from Python's automatic deletion",
"max_score": 25
},
{
"name": "Error handling structure",
"description": "Uses a try-except block to catch and handle the error raised when attempting to access the deleted exception variable, allowing the function to return information about the error type",
"max_score": 15
},
{
"name": "Try-finally-return structure",
"description": "Implements try-finally blocks with return statements in both the try block and the finally block",
"max_score": 15
},
{
"name": "Except-finally-return structure",
"description": "Implements try-except-finally blocks with return statements in both the except block and the finally block",
"max_score": 15
},
{
"name": "Finally override behavior",
"description": "Demonstrates that return statements in finally blocks always override return statements in try or except blocks (the finally return value is what the function ultimately returns)",
"max_score": 15
}
]
}