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

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


On Aug 26, 10:15 am, Carl Banks <pavlovevide... at gmail.com> 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. :-)

Evan




More information about the Python-list mailing list