[Python-Dev] innocent question ;-)

Guido van Rossum guido@python.org
Fri, 26 Oct 2001 09:42:53 -0400


> ... about my beloved buffer object:
> 
> Would a patch to make the buffer object subclassable
> be still accepted for 2.2, or does this fall under
> the feature freeze?

NO.  Go away. :-)

I think the buffer() builtin should be deprecated, not improved.

> Another question:
> It is my understanding that makeing an object
> subclassable also exposes its constructor to Python.

Yes, since otherwise there would be no way to instantiate the
subclass either.

> What is the signature of this constructor? Is the
> three argument version xxx(name, bases, dict) always used
> to return a new type object (Don Beaudry hook), and can other
> signatures freely be used to creates objects/instances
> of this type/class?

I'm sorry, I don't understand the question.  This is the constructor
signature for type object, IOW for metaclasses.  It has nothing to do
with the constructor signature for builtin classes.

Also, what do you mean by constructor?  __new__ or __init__?

Read test_descr.py for examples.  Also xxsubtype.c and various
built-in types if you're interested in doing this at the C level.

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