[Python-3000] A better way to initialize PyTypeObject

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Nov 29 01:10:41 CET 2006


Talin wrote:
> It means that 
> now the VM gets to decide what methods are special and what methods 
> aren't.

Further to that, the VM still gets to decide whether any
given special method gets a type slot. But the SPECIAL
flag is needed to say that you intend the method to be
*used* as a special method, which is something you can't
tell just from the name (as long as there exist special
methods like next() that don't use __xxx__ names).

BTW, another advantage of all this is that it provides a lot
more flexibility in the overall approach to implementing
the type object. For example, we might decide to move the
type slots into a separate memory block, so that the
type struct could be extended by subclasses in the same
way as other types.

--
Greg


More information about the Python-3000 mailing list