Sam Ruby wrote:
Leopold Toetsch wrote:

* finding the "__add" method uses VTABLE_find_method to
  find all possible "__add" methods and a distance
  function to get the best match
* the best matching function is invoked


The word "best" here should be setting off alarm bells in everybody's head. What is the chance that we can get Larry, Guido, Matz, Brenden and others to agree on such a thing? Particularly when they can't even agree on what "+" means when dealing with strings (actually, in the list above, Larry is the lone hold out... ;-) (and apologies to all involved for personifying this))

Finding the best matching function can be HLL dependent, there can be different schemes, even user code that influences it.


But I think that using the function with a minimum value of

  left.class_search_depth**2 + right.class_search_depth**2

should do it.

WRT the '+' operation: You just need a PyString_add_* and PyString_add_PyString (the same with PyList). If the class isa PyString (which includes derived classes), one of these methods will be called.

It just needs a working find_method implementation not much more.

leo



Reply via email to