|
|
|
|
|
by masklinn
2366 days ago
|
|
As OP noted, given the existence of type(a).__iadd__[0] `a += b` essentially desugars to: `a = a.__iadd__(b)`. list.__iadd__ is (sadly) defined as something like def __iadd__(self, other):
self.extend(other)
return self
So it's possible to have __iadd__ itself succeed modifying the list in place but then the "no-op" reassignment fail.[0] like many data model operations there's really a bunch of fallbacks depending on what is and is not implemented |
|