Guido van Rossum wrote:
> Some comments:
> 
> - Fredrik's solution makes one call per registered method. (I don't
> know if the patch he refers to follows that model.) That seems a fair
> amount of code for an average type -- I'm wondering if it's too early
> to worry about code bloat (I don't think the speed is going to
> matter).

One other thought: The special constants could themselves be nothing 
more than the offset into the PyTypeObject struct, i.e.:

    #define SPECMETHOD_NEW ((const char*)offsetof(PyTypeObject,tp_new))

In the PyType_Ready code, you would see if the method name had a value 
of less than sizeof(PyTypeObject); If so, then it's a special method 
name, and you fill in the struct at the specified offset.

So the interpretation of the table could be very simple and fast. It has 
a slight disadvantage from the approach of using actual string names for 
special methods, in that it doesn't allow the VM to silently 
promote/demote methods to 'special' status.

-- Talin
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to