Inside the test
function, you're not actually initializing a new Test
object, so Python will read through the class definition to use it inside the function scope, so it does execute the print statement. The problem is that you are trying to change the value of a
in the class scope and this generates that a take the previous value of a
outside the function definition.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…