[Python-Dev] Read-only function attributes
Tue, 30 Jan 2001 00:38:12 -0800 (PST)
I see that the function attribute feature specifically allows
assignment to func_code and func_defaults, but no other special
attributes. This seems really suspect to me. Why would we want
to allow the reassignment of special attributes at all?
Functions have always been immutable objects, and i can see some
motivation for attaching mutable dictionaries to them, but it's
a more serious move to make the functions mutable themselves.
I don't recall any discussion about changing special attributes;
i don't see a clear purpose to them; and i do see a danger in
making it harder to be certain that a program is safe and predictable.
(Yes, i did notice that function attributes can't be set in
restricted mode, but the addition of extra features requiring
extra security checks makes me uneasy.)