[Python-Dev] Making mutable objects readonly
Mon, 29 Jan 2001 21:57:59 -0500
> Yes, this is a good thing. Easy to do on lists and dicts. Questions:
> - How to spell it? x.freeze()? x.readonly()?
> - Should this reversible?
Of course. Or x.freeze(solid=1) to default to permanent rigidity, but not
> I.e. should there be an x.unfreeze()?
That conveniently answers the first question, since x.unreadonly() reads
> - Should we support something like this for instances too? Sometimes
> it might be cool to be able to freeze changing attribute values...
"Should be" supported for every mutable object. Next step: as in endless
C++ debates, endless Python debates about "representation freeze" vs
"logical freeze" ("well, yes, I'm changing this member, but it's just an
invisible cache so I *should* be able to tag the object as const anyway
..."; etc etc etc).
keep-it-simple-ly y'rs - tim