[Python-Dev] Re: Sets: elt in dict, lst.include

Eric S. Raymond esr@thyrsus.com
Mon, 29 Jan 2001 15:02:47 -0500


Guido van Rossum <guido@digicool.com>:
> > > Maybe we could add a flag to the dict that issues an error when a new
> > > key is inserted during such a for loop?  (I don't think the key order
> > > can be affected when a key is *deleted*.)
> > 
> > You mean: mark it read-only ? That would be a "nice to have"
> > property for a lot of mutable types indeed -- sort of like
> > low-level locks. This would be another candidate for an object flag
> > (much like the one Fred wants to introduce for weak referenced
> > objects).
> 
> Yes.

For different reasons, I'd like to be able to set a constant flag on a
object instance.  Simple semantics: if you try to assign to a
member or method, it throws an exception.

Application?  I have a large Python program that goes to a lot of effort
to build elaborate context structures in core.  It would be nice to know
they can't be even inadvertently trashed without throwing an exception I 
can watch for.
-- 
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

No one is bound to obey an unconstitutional law and no courts are bound
to enforce it.  
	-- 16 Am. Jur. Sec. 177 late 2d, Sec 256