I would like to generate a list made up of the attributes of some objects (arbitrarily) and that the changes made to the list change the object and vice versa. For example:
class objeto():
def __init__(self):
self.attr1 = 1
self.attr2 = 2
obj1 = objeto()
obj2 = objeto()
lista = [obj1.attr1, obj2.attr2]
obj1.attr1[0] = 4
# I would like to see [4, 2]
print(lista)
I know that numbers are immutable but I am wondering if there is any way to do it without using lists.