[Python-Dev] A small step to removing the type/class split

Neil Schemenauer nas@arctrix.com
Tue, 24 Oct 2000 06:45:35 -0700


On Tue, Oct 24, 2000 at 04:06:23PM -0400, Barry A. Warsaw wrote:

[on Py_TPLAGS_INSTANCE]
> I'm not sure how well this addresses what I ran into [with a
> boolean extension type].  Would PyBooleanObject then have to
> have it's Py_TPFLAGS_INSTANCE flag set?  Does that actually
> make sense?

I think it would address your problem but I don't know if the
name of the flag makes sense.  Code around PyInstance_Check()
usually looks like this:

    if (PyInstance_Check(obj)) {
        PyObject *foo = PyObject_GetAttrString(obj, "__foo__");
        ...
    }
    else {
        ...
    }

There is not a lot of code that assumes (obj->ob_type ==
PyInstance_Type) after a PyInstance_Check().  That's encouraging.

> How does this interact with the rich comparisons idea?

I don't know.  I think I am trying to a address a deeper problem
here.

> Seems like this is a hack that doesn't quite get at the heart
> of the matter, worthwhile as it may be given the current
> implementation.

Yes, I have that feeling as well.  More deep thinking is probably
required. :)

  Neil