[Python-ideas] 'Injecting' objects as function-local constants

Jan Kaliszewski zuo at chopin.edu.pl
Tue Jun 14 23:27:39 CEST 2011


Alex Light dixit (2011-06-14, 13:44):

> >>>            frmglobals = func.__globals__.copy()
> >>>            func.__globals__.update(localArgs)
> >>>            ret= func(*args, **kwargs)
> >>>            func.__globals__.clear()
> >>>            func.__globals__.update(frmglobals)

Changing global state on each call seems to be both
concurrency-and-recurrency-unsafe and inefficient.

Though that 1a (closure-based) variant should be possible using
techniques like that:
http://mail.python.org/pipermail/python-ideas/2008-October/002227.html

Retards.
*j




More information about the Python-ideas mailing list