Bug Fix

The Broken Reset Link

The Broken Reset Link

Bug Report

A function is supposed to completely reset a user's profile dictionary to default values. But after calling the function, the original dictionary remains totally unchanged.

ReferencesDictionariesMutation
Fix the Bug: The Broken Reset Link

Python passes references to objects by value — the reference itself is copied. Reassigning the parameter name inside the function only points that LOCAL name to a new dict; it does not affect the object the caller's variable still points to. To actually reset it, you must mutate the existing dict's keys.

EditorPython · JSX
PreviewUpdates on Run Tests
Loading preview…
Tests
Should mutate keys directly (e.g., profile["name"] = ...)
Should NOT reassign the 'profile' parameter to a new dict
Should still take profile as the argument