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

Ethan Furman ethan at stoneleaf.us
Fri Jun 17 23:00:00 CEST 2011


Alex Light wrote:
> Furthermore it gives the added benefit in that you can chose to run 
> 'example' so that it uses
> a true global variable, instead of an injected one. 

Only if the global is mutable.  Rebinding an immutable global requires 
the 'global' keyword, which would then clash with the injected names.

~Ethan~



More information about the Python-ideas mailing list