What is the best way to do Python expositoning? Double asterisk or math.pow?

4

What is the best way to do Python expositoning?

Should I use the ** or math.pow ?

Example math.pow :

> math.pow(3, 4);
#Imprime: 81.0

Example with double asterisks ?

> 3 ** 4
#Imprime : 81

What should I take into consideration when using them?

    
asked by anonymous 18.08.2015 / 17:30

1 answer

5

Speed

The ** fault operator is usually faster than math.pow() . It calls the native function pow , which, by the way, accepts a module argument. Usually better for integers.

Type Security

math.pow() always returns float . In this case, when types are float , math.pow() is faster.

I removed it .

    
18.08.2015 / 17:38