Evan Driscoll schrieb:
On Aug 25, 2:33 pm, Evan Driscoll <eva...@gmail.com> wrote:
I want to make a context manager that will temporarily change the
value of a variable within the scope of a 'with' that uses it. This is
inspired by a C++ RAII object I've used in a few projects. Ideally,
what I want is something like the following:

Okay, so I think I actually got this with some consultation with a
friend. Critiques?

Modifying locals isn't really allowed - it might stop working with certain implementations of python.

And to be honest - I don't really see a use-case for your whole approache. Why don't you want to introduce a new name?


Diez
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to