built-in pow() vs. math.pow()
Thomas Passin
list1 at tompassin.net
Thu Mar 30 13:25:30 EDT 2023
On 3/30/2023 5:15 AM, Andreas Eisele wrote:
> I sometimes make use of the fact that the built-in pow() function has an optional third argument for modulo calculation, which is handy when dealing with tasks from number theory, very large numbers, problems from Project Euler, etc. I was unpleasantly surprised that math.pow() does not have this feature, hence "from math import *" overwrites the built-in pow() function with a function that lacks functionality. I am wondering for the rationale of this. Does math.pow() do anything that the built-in version can not do, and if not, why is it even there?
Not an answer to your question, but it's better not to use "import *".
It's usually better to import just the names you actually need.
More information about the Python-list
mailing list