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.

Stefan

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

Reply via email to