Stefan Behnel wrote:
> Monte Milanuk, 25.02.2010 16:47:
>   
>> Is there a benefit (besides brevity) one way or the other between using:
>>
>> import math
>> ...
>> math.pow(x,y)  # x raised to the power y
>>
>> vs.
>>
>> x**y
>>
>> ?
>>     
>
> You might also be interested in this:
>
> http://docs.python.org/reference/datamodel.html#emulating-numeric-types
>
> The difference is that math.pow() is a function that works on two float
> values, whereas '**' is an operator that can work on anything, including
> your own classes. It's the number types that define the operator as meaning
> the power function, not the operator itself.
>   

So why would the coders of the math module go to the trouble of creating
the pow function? Did they create a sum function and a subtract function?
It seems to me the question has not been properly answered. When to use
one, when to use the other?
If you don't know the answer it's all right. I don't know it either.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to