On Jul 16, 3: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.
Hmm, this ques
On 7/16/2011 2:14 AM, Chris Angelico wrote:
On Sat, Jul 16, 2011 at 6:35 PM, 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
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 na
On Sat, 16 Jul 2011 19:14:47 +1000, Chris Angelico wrote:
> Only thing I can think of is:
>
> import math
> math.sqrt=lambda(x) x.__sqrt__(x) if x.whatever else math.sqrt(x)
math.sqrt=(lambda sqrt=math.sqrt: lambda x: x.__sqrt__(x) if
hasattr(x,'__sqrt__') else sqrt(x))()
--
http://mail.pytho
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 metho
On Sat, Jul 16, 2011 at 6:35 PM, 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.
O
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.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-lis