Making immutable instances

bonono at gmail.com bonono at gmail.com
Thu Dec 1 21:55:05 EST 2005


Mike Meyer wrote:
> > By design, this is a "don't use" feature so it would be very hard to
> > find a "use case" ;-)
>
> But I can think of use cases for instances with no mutable attributes,
> which is another "don't use" case. If I can do that, those proposing
> that instances ought to be immutable should be able to come up with a
> use case.
Lose you, can you clarify ?

> This is a problem with OO in general, not with not having immutable
> instances. You get the same problem if, instead of attaching
> attributes to your instances, I subclass your class and add the
> attribute in the subclass (which I can do even if both my instances
> and yours are immutable). In short, immutable instances don't solve
> your problem, so this doesn't work as a use case.
>
um, that could be true(already forgot if I can do this in say C++). How
would I solve this kind of issue then, just curious.




More information about the Python-list mailing list