I had exactly this problem in the Python Desktop Server as well. So I wrote PyDS.Context for it. There flet is defined and activated as a new builtin. Using flet you can create a dynamic context:

 > > > try: > > > _flet.begin(variable="wert") > > > ... > > > finally: _flet.end()

Not the most elegant version, but at least usable. However, I would prefer it if Python had real fluid lets like in Scheme.

At PragDave there's the original article.