3 ms·
There are no primitive variables in python. Even ints, strings, floats, etc point to a reference of an object. All nonlocal does is point the variables refere
by kgo 16y ago
There are no primitive variables in python. Even ints, strings, floats, etc point to a reference of an object. All nonlocal does is point the variables reference to a different object.
As to the advantages...
Well for one you can use the variables in closures...