[Python-Dev] A couple of quick type system questions

Guido van Rossum guido@python.org
Fri, 10 May 2002 19:53:10 -0400

> 1. I realize that some objects have no dict. Must every /type/ have
> a dict, or is it possible to have a type with only slots?

ob_type has the type PyType_Object *, and a PyType_Object has a
tp_dict pointer, so I think the answer is that every /type/ has a dict.

> 2. Suppose I want to generate a new type object dynamically? How do
> I go about choosing an appropriate allocator?

You could use the one used by type_new().

--Guido van Rossum (home page: http://www.python.org/~guido/)