How can i make this code more compact considering i will have multiple values to assign and unassign
class A:
def __init__(self,*args,**kwargs):
self._a = 0
self._b =0
def set_a(self):
self._a = 1
def set_b(self):
self._b = 1
def unset_a(self):
self._a =0
def unset_b(self):
self._b = 0
x=A()
x.set_a()
print(x._a) # 1
x.unset_a()
print(x._a) # 0
i just want to avoid to write multiple set and unset function, just a simple 1 function where i pass the type (set/unset) and which varibale to target , that will do it