I know that you should be aware while redefine setattr method that you could end in a loop.
I know there's two solution to avoid loops:
1) using object superclass, calling :
object.__setattr__(instance,attr,value)
2) using the class dict:
self.__dict__[attr] = value
My question is, shouldn't the __dict__ solution end up in a loop too? and why it isn't?
Is because that way we're calling the __setattr__ of the __dict__ object (everything is an object) or what?
And if so, shouldn't it work the same for everything?
a[b] = cdoesn't set an attribute. It sets an item. It's a different thing both conceptually and w.r.t. dunder methods involved.