The title almost sums it up but let me be example-led and clearer.
Assuming we have a class:
class T: def goto(self, value): print('go')
And a second inheriting class:
class A(T): def __init__(self): pass
Now, of course, instances of A can call the goto method.
My question is: Does this break immutability? Do we say: A always inherited T, and T always contained the goto method, so it was not mutated. Or do we say: A precedes T and inherits from T. A is therefore mutated to include the goto method and immutability is broken.
Does that make sense? I tend to think the latter because T could change over time. Therefore, A is not “immutable,” so to speak, by virtue of having inheritance.
So it leaves me wondering: Is inheritance incompatible with immutability?