kanchy kang wrote: > Hi,all > as we know, we can override the operator of one object(for example __eq__). > my question is, how to override the basic operator? > for example, > > for any object comparison operator(including litterals), > for example, > a = "123" > b = "321" > > the boolean equation a == b, > i need override "==" operator like this: > first display a and b > > then return real boolean result (a == b). > > thanks!
This isn't going to be possible without modifying the Python interpreter, as the operators are implemented as methods of objects, and the built-in objects are programmed in C and not in Python. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list