CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-wtfpython

Educational collection of surprising Python code snippets that demonstrate counter-intuitive behaviors and language internals

Overall
score

93%

Overview
Eval results
Files

Evaluation results

100%

Method Call Tracker

Descriptor protocol and method binding (__get__ protocol, bound method creation)

Criteria
Without context
With context

Implements __get__ method

100%

100%

Returns bound callable

100%

100%

Handles None instance

100%

100%

Wraps original method

100%

100%

Records call information

100%

100%

Preserves return values

100%

100%

100%

Scope Analyzer

Scope and name resolution (LEGB rule, closures, UnboundLocalError)

Criteria
Without context
With context

Closure capture technique

100%

100%

Lambda closure capture

100%

100%

Nonlocal keyword usage

100%

100%

Global keyword usage

100%

100%

UnboundLocalError demonstration

100%

100%

100%

String Identity Analyzer

String interning and identity (is vs ==)

Criteria
Without context
With context

Identity operator usage

100%

100%

Equality operator usage

100%

100%

String length check

100%

100%

Special character detection

100%

100%

ASCII-only validation

100%

100%

Return type correctness

100%

100%

83%

-2%

Python Bytecode Optimization Analyzer

Bytecode and compiler optimization (constant folding, AST vs peephole)

Criteria
Without context
With context

dis.dis() usage

100%

100%

compile() function

100%

100%

LOAD_CONST detection

100%

100%

co_consts access

0%

0%

Instruction parsing

100%

100%

Folding detection logic

100%

80%

Instruction counting

100%

100%

89%

4%

Class Behavior Analyzer

Class and object behavior (attributes, method identity, name mangling)

Criteria
Without context
With context

Attribute Type Detection

83%

93%

Method Identity Check

100%

100%

Name Mangling Logic

100%

100%

Error Handling

33%

40%

100%

Exception Handler Analyzer

Exception handling (variable deletion, try-finally-return)

Criteria
Without context
With context

Exception variable capture

100%

100%

Variable deletion detection

100%

100%

Error handling structure

100%

100%

Try-finally-return structure

100%

100%

Except-finally-return structure

100%

100%

Finally override behavior

100%

100%

95%

35%

Closure Variable Inspector

Closure and scope semantics (late binding, inspect.getclosurevars, generator scoping)

Criteria
Without context
With context

Uses inspect.getclosurevars

0%

80%

Late binding implementation

75%

100%

Early binding pattern

100%

100%

Generator scope analysis

60%

100%

Closure validation

80%

100%

Generator validation

100%

100%

100%

Safe Function Registry

Mutable vs immutable objects (default arguments, references)

Criteria
Without context
With context

Mutable default avoidance

100%

100%

Independent storage

100%

100%

Defensive copying

100%

100%

Correct execution

100%

100%

100%

Unicode Identifier Validator

Unicode and character encoding (lookalike characters, raw string limitations)

Criteria
Without context
With context

Unicode code point extraction

100%

100%

Code point formatting

100%

100%

ASCII range detection

100%

100%

Lookalike mapping

100%

100%

Character position tracking

100%

100%

Risk classification logic

100%

100%

62%

12%

Financial Calculator with Precise Rounding

Numeric operations (banker's rounding, conversion limits, float precision)

Criteria
Without context
With context

Uses round() function

0%

0%

String length validation

80%

92%

Uses int() or float()

0%

100%

Float precision check

100%

80%

Install with Tessl CLI

npx tessl i tessl/pypi-wtfpython
Evaluated
Agent
Codex

Table of Contents