On Sat, Jul 16, 2011 at 6:35 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> 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.
Only thing I can think of is: import math math.sqrt=lambda(x) x.__sqrt__(x) if x.whatever else math.sqrt(x) I don't suppose there's a lambda version of try/catch? ChrisA -- http://mail.python.org/mailman/listinfo/python-list