Steven D'Aprano wrote: > I have a custom object that customises the usual maths functions and > operators, such as addition, multiplication, math.ceil etc. > > Is there a way to also customise math.sqrt? I don't think there is, but I > may have missed something.
There seem to be only three methods that can be customized: $ grep 'LookupSpecial' mathmodule.c method = _PyObject_LookupSpecial(number, "__ceil__", &ceil_str); method = _PyObject_LookupSpecial(number, "__floor__", &floor_str); trunc = _PyObject_LookupSpecial(number, "__trunc__", &trunc_str); -- http://mail.python.org/mailman/listinfo/python-list