Questions about `locals` builtin

Chris Angelico rosuav at gmail.com
Wed Feb 28 08:51:09 EST 2018


On Wed, Feb 28, 2018 at 10:58 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Wed, 28 Feb 2018 18:04:11 +1100, Chris Angelico wrote:
>> But if you know that
>> there's only a handful of variables that you'd actually want to do that
>> to, you can simply put those into an object of some form, and then
>> mutate that object.
>
> o_O
>
> If I knew ahead of time which variables held the wrong value, I'd fix
> them so they held the right value ahead of time, and not bother using a
> debugger.
>
> :-)

Ahh but that requires that you know the right value as well. It's
plausible that you have a handful of "tweakables" but you have no idea
what to tweak them *to*. That's where this would be plausible.

ChrisA



More information about the Python-list mailing list