[issue11477] Bug in code dispatching based on internal slots

Terry J. Reedy report at bugs.python.org
Mon Mar 14 18:43:37 CET 2011

Terry J. Reedy <tjreedy at udel.edu> added the comment:

It seems to me that the underlying (design) flaw is having duplicate slots in the C type structure*.  I presume that having two different functions in num-add and seq-add (concat) (I know, not quite the proper names), etc, is an error. I also assume that changing the structure is out, whether frozen in the ABI or not, as disabling every extention type.

But could we change how the slots are handled? For instance, when class is created, if nun-add is absent and seq-add is present, copy seq-add to num-add and thereafter only use num-add and treat seq-add as a dummy left for back compatibility.  In other words, merge the duplicate slots in their effect, so there is a proper 1-1 relationship between syntax operators and methods, as there is for Python-coded classes.

*I am guessing that this was for convenience -- making a number? fill in num slots; making a sequence? fill in seq slots. Or perhaps Guido once had some idea of possibly separating the operators/functions at the Python level. Does not matter at present.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list