Easy immutability in python?
aleaxit at yahoo.com
Sat Mar 4 21:17:04 CET 2006
Terry Hancock <hancock at anansispaceworks.com> wrote:
> I also am not trying to alter the Python language. I am
> trying to figure out how to most easily fix __setattr__ etc
> to act immutably, *using* the existing features.
> I can already do what I want with some 25-30 lines of code
> repeated each time I need it, but I think it's dumb that
> it's that complicated.
If you need many immutable classes, inject __setattr__ etc into them
(via metaclass or otherwise).
More information about the Python-list