Context manager to temporarily change the variable of a register [aka write swap(a,b)]

Evan Driscoll evaned at
Wed Aug 26 21:12:59 CEST 2009

On Aug 26, 10:15 am, Carl Banks <pavlovevide... at> wrote:
> Well, it wouldn't be a "can I rebind a variable using a with-
> statement" thread if someone didn't post a solution that they thought
> worked, but didn't test it on local variables.

I'm not going to deny it was pretty stupid... though in my defense,
I'm new at more that trivial Python coding and don't have the Python
scoping rules and such ingrained in my mind yet. :-)


More information about the Python-list mailing list