[Python-Dev] Re: Making mutable objects readonly

Barry A. Warsaw barry@digicool.com
Mon, 29 Jan 2001 23:26:50 -0500


>>>>> "ESR" == Eric S Raymond <esr@thyrsus.com> writes:

    ESR> Fortunately, there's a semantics that captures both.  If we
    ESR> allow freeze to take an optional key argument, and require
    ESR> that an unfreeze call must supply the same key or fail, we
    ESR> get both worlds.  We can even one-way-hash the keys so they
    ESR> don't have to be stored in the bytecode.

    ESR> Want to lock a structure permanently?  Pick a random long
    ESR> key.  Freeze with it.  Then throw that key away...

Clever!