Aother thing to consider is that math.sqrt is not the only
sqrt function in Python. There is also one in cmath, and
in the wider ecosystem, another one in numpy. Being explicit
about which one you're using is a good thing.

Concerning exponentiation, it can be used to achieve the same
thing as sqrt, but the sqrt function probably uses a more
efficient algorithm.

Also, exponentiation assumes you're okay with getting a
complex result:

>>> (-27)**0.5
(3.181725716174721e-16+5.196152422706632j)

So it's not quite the same thing as math.sqrt().

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to