ground truth verified by execution for all 10 cases model=google/gemma-2-2b dtype=torch.bfloat16 === closure-late-binding === lambdas capture the VARIABLE i, not its value; all three see i=2 python says: [2, 2, 2] 79.30% '0' 7.37% '3' 4.47% '1' 3.47% 'None' 1.87% '<' 0.88% '2' 0.53% 'lambda' 0.47% ' ' -> P('2') = 0.88% [correct ([2, 2, 2]: late binding)] -> P('0') = 79.30% [wrong ([0, 1, 2]: value captured per iteration)] === closure-default-arg-fix === pair of the above: i=i binds eagerly, so the answer flips python says: [0, 1, 2] 66.80% '0' 13.18% '3' 13.18% '1' 2.59% 'None' 1.39% '2' 0.66% '<' 0.51% ' ' 0.35% 'lambda' -> P('0') = 66.80% [correct ([0, 1, 2]: default arg binds now)] -> P('2') = 1.39% [wrong (would mean the i=i fix did nothing)] === mutable-default === the default list is created once, at def time, and persists python says: [1, 2] 89.06% '1' 10.64% '2' 0.08% '3' 0.01% '\n' 0.01% ' ' 0.01% '<' 0.00% '0' 0.00% '?,' -> P('1') = 89.06% [correct ([1, 2]: the default persists)] -> P('2') = 10.64% [wrong ([2]: fresh list each call)] === mutable-default-fix === pair of the above: acc=None makes a fresh list, answer flips python says: [2] 93.36% '1' 6.74% '2' 0.02% '3' 0.01% ' ' 0.01% '\n' 0.00% '0' 0.00% '<' 0.00% '...' -> P('2') = 6.74% [correct ([2]: fresh list)] -> P('1') = 93.36% [wrong ([1, 2]: would mean the fix did nothing)] === for-var-leaks === a for-loop variable outlives the loop python says: 2 35.55% 'Traceback' 13.09% '>>>' 7.91% '...' 6.98% '3' 6.98% '0' 4.81% '1' 3.30% 'Syntax' 1.56% '2' -> P('2') = 1.56% [correct (the loop var leaks)] -> P('Traceback') = 35.55% [wrong (would mean the loop scoped it)] === comprehension-no-leak === pair of the above: a comprehension variable does NOT leak in py3 python says: !NameError 33.59% '2' 29.69% '1' 20.31% '0' 5.15% 'Traceback' 2.15% '3' 1.67% 'j' 0.79% 'Syntax' 0.70% 'TypeError' -> P('Traceback') = 5.15% [correct (NameError: comprehensions have own scope)] -> P('2') = 33.59% [wrong (would be Python 2 behaviour)] === tuple-augmented-assign === t[0] += [2] raises TypeError AND still mutates the list python says: ([1, 2],) 37.11% '],' 32.81% ',' 28.91% '])' 0.60% ']' 0.20% ']+' 0.06% '],[' 0.03% '2' 0.03% ']),' -> P(',') = 32.81% [correct (([1, 2],): the mutation happened anyway)] -> P(']') = 0.60% [wrong (([1],): error implies no change)] === class-body-scope === a comprehension in a class body cannot see the class-level name python says: !NameError 70.70% '>>>' 26.17% '...' 0.54% 'Traceback' 0.33% 'def' 0.29% 'class' 0.09% '>>>>' 0.08% '#' 0.08% 'The' -> P('Traceback') = 0.54% [correct (NameError: xs not visible in the comprehension)] -> P('>') = 0.07% [wrong (would mean the class body defined cleanly)] === class-body-ok === pair of the above: the OUTERMOST iterable IS evaluated in class scope python says: [2, 4, 6] 93.75% '2' 5.30% '1' 0.16% ' ' 0.16% '3' 0.14% '4' 0.09% '\n' 0.07% 'None' 0.05% 'x' -> P('2') = 93.75% [correct ([2, 4, 6]: outer iterable sees class scope)] -> P('Traceback') = 0.00% [wrong (this one is legal)] === chained-comparison === `1 in [1,2] == True` chains as (1 in [1,2]) and ([1,2] == True) python says: False 64.45% '>>>' 11.23% 'True' 5.30% 'False' 2.50% '#' 1.95% ' ' 1.18% '1' 0.92% '2' 0.63% ' ' -> P('False') = 5.30% [correct (chained comparison)] -> P('True') = 11.23% [wrong (reads it as (1 in [1,2]) == True)] === summary (first candidate is the correct one) === case P(correct) P(wrong) verdict closure-late-binding 0.88% 79.30% MISS closure-default-arg-fix 66.80% 1.39% ok mutable-default 89.06% 10.64% ok mutable-default-fix 6.74% 93.36% MISS for-var-leaks 1.56% 35.55% MISS comprehension-no-leak 5.15% 33.59% MISS tuple-augmented-assign 32.81% 0.60% ok class-body-scope 0.54% 0.07% noise class-body-ok 93.75% 0.00% ok chained-comparison 5.30% 11.23% MISS === paired scoring (the point of the design) === closure capture closure-late-binding=MISS closure-default-arg-fix=ok -> fail default argument mutable-default=ok mutable-default-fix=MISS -> fail does the loop var leak for-var-leaks=MISS comprehension-no-leak=MISS -> fail class-body comprehension class-body-scope=noise class-body-ok=ok -> fail pairs passed: 0/4 A pair scored 'ok'+'MISS' means the model gave the SAME answer to both members -- surface-form matching, not binding semantics.