[pypy-dev] interface changes (would-have-been: builtin -- gettingstarted)

Armin Rigo arigo at tunes.org
Sun Mar 2 17:09:01 CET 2003

Hello Samuele,

On Sat, Mar 01, 2003 at 10:21:33AM +0100, Samuele Pedroni wrote:
> 2) unless my last email titled 'question' has gone lost, I'm a bit worried
> given that it didn't receive any kind of answer, even as short as 'no'

Sorry, I´m short on internet time these days.  Multidispatch has been
discussed at the beginning, and (in my mind) the scheme that we came up with
is that the dispatch is based on the "implementation" of an object, not on its
type.  All objects of any user-defined type are instances of a single
W_UserObject class (say).  At this point, users cannot dynamically add new
implementations (maybe could be changed later).


class W_UserObject:
  def __init__(w_self, w_basepart, w_usertype):
    <here, w_basepart is an object implementing the "base" built-in part of 

def user_any_add(space, w_userobj, w_otherobj):
  <here we emulate Python's __add__ behavior by looking for this method in 
w_usertype, and if not found, calling add() on w_basepart and w_otherobj>


More information about the Pypy-dev mailing list