or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/wtfpython@3.0.x
tile.json

tessl/pypi-wtfpython

tessl install tessl/pypi-wtfpython@3.0.0

Educational 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%

rubric.jsonevals/scenario-9/

{
  "context": "This criteria evaluates how well the engineer uses Python's inspect module and demonstrates understanding of closure semantics, late binding, early binding, and generator scoping. The focus is on correct usage of inspect.getclosurevars() and proper implementation of closure variable capture patterns.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Uses inspect.getclosurevars",
      "description": "The inspect_closure function correctly uses inspect.getclosurevars() to examine the closure and extract captured variables from the nonlocals, globals, builtins, and unbound attributes.",
      "max_score": 25
    },
    {
      "name": "Late binding implementation",
      "description": "The create_late_binding_closures function correctly demonstrates late binding by creating closures that capture loop variables by reference, resulting in all closures sharing the same final value of the loop variable.",
      "max_score": 20
    },
    {
      "name": "Early binding pattern",
      "description": "The create_early_binding_closures function correctly implements early binding using either default parameter values (e.g., lambda i=i: i) or similar techniques to capture the loop variable's value at creation time.",
      "max_score": 20
    },
    {
      "name": "Generator scope analysis",
      "description": "The analyze_generator_scope function correctly uses inspect.getclosurevars() or similar inspect module functions to analyze the generator function's closure variables before the generator is instantiated.",
      "max_score": 20
    },
    {
      "name": "Closure validation",
      "description": "The inspect_closure function properly validates that the input is a closure by checking if func.__closure__ is not None and handles non-closure functions appropriately.",
      "max_score": 10
    },
    {
      "name": "Generator validation",
      "description": "The analyze_generator_scope function properly validates that the input is a generator function using inspect.isgeneratorfunction() or by checking for appropriate attributes.",
      "max_score": 5
    }
  ]
}