I\'m trying to perform some analysis of scope in Python 3 source code and I\'m stuck with how the nonlocal statement statement works inside a class definition.
Python handles class and function definitions rather differently. For example, your A.v is not a variable of A but rather an attribute of it. The namespace created by a class is not, therefore, a scope. I am not surprised that nonlocal does not work as you're trying to use it.