Message262722
> A national variable maybe :)
I would think that "nonlocal" is exactly the right term given that that is how you would declare it if you wanted to write to it.
>>> w = 5
>>> def f(x):
def g(y):
nonlocal x
global w
z = x + y
x += 1
print(locals())
print(globals())
return g
>>> f(10)(20)
{'y': 20, 'x': 11, 'z': 30}
{'w': 5, ...} |
|
Date |
User |
Action |
Args |
2016-04-01 04:53:44 | rhettinger | set | recipients:
+ rhettinger, docs@python, martin.panter |
2016-04-01 04:53:44 | rhettinger | set | messageid: <1459486424.89.0.597390584648.issue26683@psf.upfronthosting.co.za> |
2016-04-01 04:53:44 | rhettinger | link | issue26683 messages |
2016-04-01 04:53:44 | rhettinger | create | |
|