built-in pow() vs. math.pow()
Grant Edwards
grant.b.edwards at gmail.com
Thu Mar 30 15:15:03 EDT 2023
On 2023-03-30, Thomas Passin <list1 at tompassin.net> wrote:
> On 3/30/2023 5:15 AM, Andreas Eisele wrote:
>> [...] 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. [...]
>
> 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.
Or to imporot math and then use math.pow().
Unfortunately, the official Python documentation always seems to
assume you do "from <whatever> import *". I think that leads people to
believe it's a good practice when, in fact, it's a frequent source of
trouble as the OP found out.
--
Grant
More information about the Python-list
mailing list