On 07/16/2011 01:35 AM, 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.


Create a file named myMath.py containing:
--------------------------------------
from math import *

def sqrt(x):
    ...whatever you want...
---------------------------------------

Then you can:
  import math #to get normal stuff and
  import myMath # to get your customized stuff
or
  import myMath as math # to get your stuff but named math.



Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to