"Robert Dailey" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
> ------=_Part_51775_19953536.1185988361742 > Hi, > > I'm currently interested in creating an __add__() operator for one of > my classes. This class handles both integers and objects its own type, > however I don't know how I can perform special add operations > depending on which is passed in. Since I haven't seen any evidence of > function overloading, I'm assuming I'll have to check the types of the > variables passed in inside of my __add__() method. > > Take the two following examples: > > vector3(3,4,2) + 5 = vector3(8,9,7) > vector3(3,2,1) + vector3(4,5,6) = vector3(7,7,7) > > Any tips? Thanks. > That's an option. Another option was posted a while ago by GvR and was using some decorator to dispatch to different methods according to the type. I don't seem to find the link right now, but you can search it on GvR blog. bests, ./alex -- .w( the_mindstorm )p. -- http://mail.python.org/mailman/listinfo/python-list