[Python-Dev] Py_TPFLAGS_HEAPTYPE too overloaded

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jul 28 01:52:43 CEST 2009


Joshua Haberman wrote:
> Python as a language has chosen to "lock down" built-in
> objects...  If it's
> important for the built-in types, why should it be less important for
> mine?

I'm not really sure why so much trouble is taken to lock
down builtin types -- it seems to go against Python's
general consenting-adults philosophy.

I suppose it's felt that you should be able to rely on
builtin types not changing their behaviour. This is probably
more important for the core types than those in extension
modules. Many of the standard library classes are written in
Python, so this protection doesn't extend to them.

> I don't want my type to be a second-class citizen just because I happen
> to be dynamically allocating it.

I don't think anyone will regard your types as second-class
because they allow you to do *more* with them.

The only real concern would be if it were somehow possible
to crash the interpreter by modifying the type dict.
I don't see how that could happen -- but maybe someone
else on python-dev knows more about this?

-- 
Greg


More information about the Python-Dev mailing list