the global keyword:

Random832 random832 at fastmail.com
Tue Jun 21 13:15:21 EDT 2016



On Tue, Jun 21, 2016, at 13:04, Rick Johnson wrote:
> On Sunday, June 12, 2016 at 2:08:01 PM UTC-5, BartC wrote:
> > Anyway, it shows Python doesn't have true cross-module globals.
> 
> BS! You can inject symbols into sys.modules and achieve a
> true global.

You can put a function or constant there, sure. But if you're using it
as a variable, you'd have to do that *every* time (in which case what's
the point) because reassigning to a builtin by name won't reassign the
builtin, it'll create a new variable in the current context.


More information about the Python-list mailing list