[Python-Dev] Re: Making mutable objects readonly

M.-A. Lemburg mal@lemburg.com
Wed, 31 Jan 2001 13:10:43 +0100

Tim Peters wrote:
> Note that even adding a "frozen" flag would add 4 bytes to every freezable
> object on most machines.  That's why I'd rather .freeze() replace the type
> pointer and .unfreeze() restore it.  No time or space overhead; no
> cluttering up the normal-case (i.e., unfrozen) type implementations with new
> tests.

Note that Fred's weak ref implementation also need a flag on every
weak referencable object (at least last time I looked at his patches).

Why not add a flag byte or word to these objects -- then we'd have
8 or 16 choices of what to do with them ;-)

Marc-Andre Lemburg
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/