3 ms·
It works the moment you wrap the int in a class. class A: a = 0 def modify (v): v.a = 2 a1 = A() a1.a = 1 print(a1.a) modify(a1) print(a1.a)
by constantcrying 2y ago
It works the moment you wrap the int in a class.
class A:
a = 0
def modify (v):
v.a = 2
a1 = A()
a1.a = 1
print(a1.a)
modify(a1)
print(a1.a)