nonlocal in Python 3
#TIL about nonlocal in Python 3 Inner functions can access outer variables but can’t modify them by default Here’s a contrived simple example def outer(): num = 0 def inner(): nonlocal num num += 1 inner() If you remove t...
Aug 28, 20251 min read3